com.mangofactory.swagger.paths
Class SwaggerPathProvider

java.lang.Object
  extended by com.mangofactory.swagger.paths.SwaggerPathProvider
Direct Known Subclasses:
AbsoluteSwaggerPathProvider, RelativeSwaggerPathProvider

public abstract class SwaggerPathProvider
extends java.lang.Object


Constructor Summary
SwaggerPathProvider()
           
 
Method Summary
protected abstract  java.lang.String applicationPath()
          For relative SwaggerPathProviders this is typically '/' meaning relative to the swagger ui page serving the documentation.
 java.lang.String getApiResourcePrefix()
           
 java.lang.String getApplicationBasePath()
           
protected abstract  java.lang.String getDocumentationPath()
          The base path to the swagger api documentation.
 java.lang.String getOperationPath(java.lang.String operationPath)
          The relative path to the operation, from the basePath, which this operation describes.
 java.lang.String getResourceListingPath(java.lang.String swaggerGroup, java.lang.String apiDeclaration)
          Corresponds to the path attribute of a swagger Resource Object (within a Resource Listing).
 java.lang.String sanitiseUrl(java.lang.String candidate)
           
 void setApiResourcePrefix(java.lang.String apiResourcePrefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwaggerPathProvider

public SwaggerPathProvider()
Method Detail

getApiResourcePrefix

public java.lang.String getApiResourcePrefix()

setApiResourcePrefix

public void setApiResourcePrefix(java.lang.String apiResourcePrefix)

applicationPath

protected abstract java.lang.String applicationPath()
For relative SwaggerPathProviders this is typically '/' meaning relative to the swagger ui page serving the documentation. The swagger specification recommends that this should be an absolute URL. Corresponds to the base path attribute of a swagger api declaration. This is the actual base path serving the api (not the swagger documentation)

Returns:
the applications base uri

getDocumentationPath

protected abstract java.lang.String getDocumentationPath()
The base path to the swagger api documentation. Typically docs are served from <yourApp>/api-docs so a relative resourceListing path will omit the api-docs segment. E.g. Relative: "path": "/" Absolute: "path": "http://localhost:8080/api-docs"

Returns:
the documentation base path

getApplicationBasePath

public java.lang.String getApplicationBasePath()

getOperationPath

public java.lang.String getOperationPath(java.lang.String operationPath)
The relative path to the operation, from the basePath, which this operation describes. The value SHOULD be in a relative (URL) path format. Includes the apiResourcePrefix

Parameters:
operationPath -
Returns:
the relative path to the api operation
See Also:
getApplicationBasePath()

getResourceListingPath

public java.lang.String getResourceListingPath(java.lang.String swaggerGroup,
                                               java.lang.String apiDeclaration)
Corresponds to the path attribute of a swagger Resource Object (within a Resource Listing). This method builds a URL based off of

Parameters:
swaggerGroup - the swagger for this Resource Object e.g. 'default'
apiDeclaration - the identifier for the api declaration e.g 'business-controller'
Returns:
the resource listing path
See Also:
by appending the swagger group and apiDeclaration

sanitiseUrl

public java.lang.String sanitiseUrl(java.lang.String candidate)