Class SwaggerGenerator

    • Constructor Detail

      • SwaggerGenerator

        public SwaggerGenerator()
    • Method Detail

      • updateResponse

        protected void updateResponse​(org.wso2.carbon.core.transports.CarbonHttpResponse response,
                                      String responseString,
                                      String contentType)
                               throws org.apache.axis2.AxisFault
        Update the response with provided response string.
        Parameters:
        response - CarbonHttpResponse which will be updated
        responseString - String response to be updated in response
        contentType - Content type of the response to be updated in response headaers
        Throws:
        Exception - Any exception occured during the update
        org.apache.axis2.AxisFault
      • getAPIFromSynapseConfig

        protected org.apache.synapse.api.API getAPIFromSynapseConfig​(org.wso2.carbon.core.transports.CarbonHttpRequest request)
        Returns API instance related to the URI in provided request.
        Parameters:
        request - CarbonHttpRequest which contains the request URI info
        Returns:
        API instance with respect to the request
      • getApiNameFromRequestUri

        protected String getApiNameFromRequestUri​(String requestUri)
        Extract API Name from the given URI.
        Parameters:
        requestUri - URI String of the request
        Returns:
        API Name extracted from the URI provided
      • retrieveAPISwaggerFromRegistry

        protected String retrieveAPISwaggerFromRegistry​(org.apache.synapse.api.API api,
                                                        String requestURI)
                                                 throws org.wso2.carbon.registry.core.exceptions.RegistryException
        Function to extract swagger definition from the registry
        Parameters:
        api - API object
        requestURI - request URI info
        Returns:
        null if registry content unavailable or empty, otherwise relevant content
        Throws:
        org.wso2.carbon.registry.core.exceptions.RegistryException
      • handleException

        protected void handleException​(String errorMsg)
                                throws org.apache.axis2.AxisFault
        Logs the error message and throws New AxisFault.
        Parameters:
        errorMsg - String message which contains error information
        Throws:
        org.apache.axis2.AxisFault - throws with error information