<-- Back

Custom response codes in published REST service swagger

Issue

The application project requires custom response codes (for example, 201, 400, 404, 500) in the Swagger of a REST service; however, this is not available in Mendix.

Environment

Studio Pro (all versions)

Cause

Mendix does not support the automatic publishing of multiple custom response codes (for example, 201, 400, 404, 500) in the Swagger of a REST service; only 200 is generated by default.

Solution / Workaround

To display different response codes in the Swagger documentation, manual adjustments are required.
The only direct way is to manually edit the swagger.json  file exported by Mendix and add the desired responses to each operation.


Changes to the  swagger.json  can be overwritten by Mendix when restarting or republishing, so this approach requires recurring maintenance.

Internal information related

  • 260250
  • C0A044PPS/p1758547323445689

Additional information

Not Applicable

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.