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: issue where response schemas in the original spec may get overridden #634

Merged
merged 2 commits into from
Apr 8, 2022

Conversation

erunion
Copy link
Member

@erunion erunion commented Apr 7, 2022

🧰 Changes

This resolves a data corruption bug I discovered in https://github.com/readmeio/api where if you compile the JSON Schema for an operation response with getResponseAsJsonSchema, and somewhere within that response is an example property, we'd update the original API definition object that was supplied to Oas with the examples syntax that getResponseAsJsonSchema reshapes example to -- rendering the original API definition in a non-spec validating state.

🧬 QA & Testing

I added a test that runs getResponseAsJsonSchema against a response in our own spec and then queries the original spec inside the original Oas instance to ensure that the schema property where example was present is only set to examples in the generated JSON Schema.

:upsidedown-cowboy-quadboy:

@erunion erunion added bug Something isn't working area:tooling labels Apr 7, 2022
Copy link
Contributor

@julshotal julshotal left a comment

Choose a reason for hiding this comment

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

ty for adding the validation test!

@erunion erunion merged commit 60093d9 into main Apr 8, 2022
@erunion erunion deleted the fix/response-schema-corruption branch April 8, 2022 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants