fabien0102 / openapi-codegen

A tool for generating code base on an OpenAPI schema.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve handling of default value in responses for successful status codes

zloit opened this issue · comments

Hello,

I have noticed a potential issue with your OpenAPI code generator regarding the interpretation of the default value in the responses section.

The problem is that when there is no explicitly defined schema for the 200 status, the default value is considered as an error/unsuccessful response, whereas it would be logical to consider it as a successful response.

I propose the following changes:

  1. Improved interpretation of default: Make the default value be treated as a successful response when there are no explicitly defined schemas for the 200 status. This aligns with standard practice and meets developers' expectations for API responses.

  2. Documentation update: Clarify in the generator's documentation or README file how the default value is handled and how developers can use it for successful responses.

  3. Explain the changes: Describe in the CHANGELOG file or user guide that changes have been made regarding the interpretation of default and what benefits it brings.

The interpretation of the default value in the responses section is crucial for a proper understanding of API response schemas and the generation of client-side code that handles responses according to expectations. Clarifying this aspect will help developers make more effective use of your generator.

Thank you for your work on this generator, and I hope that the proposed changes will be considered.