Class SwaggerUtils


  • public final class SwaggerUtils
    extends Object
    Util class with methods to generate swagger definition and fetch them from the registry.
    • Constructor Detail

      • SwaggerUtils

        public SwaggerUtils()
    • 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.