Class SwaggerUtils
- java.lang.Object
-
- org.wso2.carbon.mediation.transport.handlers.requestprocessors.swagger.format.utils.SwaggerUtils
-
public final class SwaggerUtils extends Object
Util class with methods to generate swagger definition and fetch them from the registry.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DATA_TYPE_BOOLEAN
static String
DATA_TYPE_INTEGER
static String
DATA_TYPE_NUMBER
-
Constructor Summary
Constructors Constructor Description SwaggerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
fetchSwaggerFromRegistry(String requestURI, String resourcePath)
Util method to fetch a swagger resource from the registry.static String
getDataServiceSwagger(String requestURI, org.apache.axis2.context.ConfigurationContext configurationContext, boolean isJSON)
Fetch the swagger from registry if available or create one from scratch.
-
-
-
Field Detail
-
DATA_TYPE_INTEGER
public static final String DATA_TYPE_INTEGER
- See Also:
- Constant Field Values
-
DATA_TYPE_NUMBER
public static final String DATA_TYPE_NUMBER
- See Also:
- Constant Field Values
-
DATA_TYPE_BOOLEAN
public static final String DATA_TYPE_BOOLEAN
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDataServiceSwagger
public static String getDataServiceSwagger(String requestURI, org.apache.axis2.context.ConfigurationContext configurationContext, boolean isJSON) throws org.apache.axis2.AxisFault
Fetch the swagger from registry if available or create one from scratch.- Parameters:
requestURI
- request URI.configurationContext
- Configuration context with details.isJSON
- result format JSON or YAML.- Returns:
- Swagger definition as string
- Throws:
org.apache.axis2.AxisFault
- Error occurred while fetching the host details.
-
fetchSwaggerFromRegistry
public static String fetchSwaggerFromRegistry(String requestURI, String resourcePath) throws org.wso2.carbon.registry.core.exceptions.RegistryException
Util method to fetch a swagger resource from the registry.- Parameters:
requestURI
- request URI.resourcePath
- registry path to the resource.- Returns:
- Swagger definition as string or null if error occurred.
- Throws:
org.wso2.carbon.registry.core.exceptions.RegistryException
- error occured while fetching the resource from registry.
-
-