Sending HTTP Response that swagger understands

1
Good Afternoon!   I am working on some REST services that uses a fairly extensive microflow that could return a variety of errors. I am wondering if there is a certain structure of HTTP response that is understood by swagger documentation? Right now my response status codes are returning correctly when I test the calls but swagger is not documenting the different responses and their status codes up front.  I have tried to find documentation that describes this but I am currently out of luck. If anyone has any information or documentation to refer me to so swagger will automatically document the different response status codes that would be much appreciated! Edit: Adding some extra information, I am currently returning an HTTP response object at the end of my microflow and using an export mapping to convert a list into a json and including that in the content of the HTTP reponse object.
asked
4 answers
1

Any progress on this? I have the same question.

answered
1

In the screenshot I see that the microflow executes the mapping, assignes it to the HttpResponse, and returns that.

The alternative (that gives you a schema in swagger.json) is to have the microflow return the list of objects, and specify the export mapping in the REST operation.

For more information, see https://docs.mendix.com/refguide/published-rest-operation/#2172-export-mapping

answered
0

When Studio Pro creates the swagger documentation it does not analyze the model’s microflows for what to expect. So operation microflows that return an HttpResponse object will have a default response documented in swagger.

 

The way to get more details about the respone in the swagger.json is to return an object or a list and specify a mapping based on a message definition.

answered
0

Thanks for your answer.

So I  have a message definition and a export_mapping object defined. The export mapping is using the message definition. The webservice is running perfect but the swagger response 200, 400, 500 example and model info stay empty (see below).

What am I missing?

 

 

answered