Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(openapi): use status code from ir in openapi spec #5722

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gustavkauman
Copy link

Description

This PR fixes a bug where the response code defined in the Fern specification would not be reflected in the generated OpenAPI specification. This is achieved by using the response code from the intermediary representation instead of the hardcoded "200" success response.

If a status code is not explicitly defined in the specification it will default to 200, hence it will not break existing users.

Fixes #4777.

Changes Made

  • Changed the OpenAPI generator to use the status code from the intermediary representation.

Testing

Test have been manually performed by verifying the outputted yaml file. Additionally, our own verification tool complained about the response code not matching the specification. This stopped with the updated file.

Our files and a diff between the two can be found attached.

openapi-fixed.json
openapi-origin.json
openapi-json-diff.txt

  • Unit tests added/updated
  • Manual testing completed

Copy link
Member

@dsinghvi dsinghvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gustavkauman https://github.com/fern-api/fern/blob/main/generators/openapi/versions.yml up to add a changelog here so that we can merge in this contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Response status-code is not reflected in generated openapi spec
2 participants