Swagger schema contains nested model definitions which in turn could contain other nested models. This library is created to parse all these the nested responses for a given path and HTTP Method and store it in a HashMap.
SwaggerSchemaParser swaggerSchemaParser = new SwaggerSchemaParser();
swaggerSchemaParser.initializeParser("http://petstore.swagger.io/v2/swagger.json");
HashMap<String, HashMap<String, String>> parsedResponse= swaggerSchemaParser.parseResponse("/pet/findByStatus", HttpMethod.GET,ResponseType.OK);
-
path
The sub path that needs to be parsed.(Required)
-
HTTPMethod:
Can be GET,PUT,POST or DELETE.(Required)
-
ResponseType:
This specifies the HTTPResponse status we are looking for. Can be one of the following:(Optional. Default is All)
- OK("200"),
- NOT_FOUND("404"),
- BAD_REQUEST("400"),
- INTERNAL_SERVER_ERROR("500"),
- NOT_IMPLEMENTED("502"),
- BAD_GATEWAY("502"),
- SERVICE_UNAVAILABLE("503"),
- All("All") : This will return all responses that are returned by swagger.
RecursiveSwaggerSchemaParser is released under GNU Public License version 3.0