Open shuawest opened 6 years ago
It looks like I could also switch to the generic response, but that doesn't appear to be working in 2.2.2. I can only generate an API with the List
It would still be best to have a wrapper entity when you need data from header.
Description
I'm creating a JAXRS CXF swagger spec for an existing REST/JSON API that I don't control. The API has a number of paginated result sets where the response is an array as a body payload, and puts before/after markers in the HTTP response header.
Swagger-codegen version
swagger-jaxrs 2.2.3 swagger-codegen-maven-plugin 2.2.3 with language jaxrs-cxf
Swagger declaration file content or url
https://docs.gdax.com/#pagination
Clip of the mocked up / expected Swagger spec with pagination in response header
Suggest a fix/enhancement
Allow for a response wrapper to be generated such the response body is an element of a response object. Allow the Swagger/OpenAPI spec author to use the responses>headers>{header-key} yaml to define which headers should be in the response object. Allow backward compatibility by controlling the response wrapping behavior with a codegen parameter.
Wrapper 'off' generates API method: public List getTrades(String productId, long before, long after, long limit);
Wrapper 'on' generates (new bahavior):
public TradeResponse getTrades(String productId, long before, long after, long limit);