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: bug where request example selection wouldn't always use the first #739

Merged
merged 1 commit into from
Mar 8, 2023

Conversation

erunion
Copy link
Member

@erunion erunion commented Mar 7, 2023

🚥 Fixes RM-6662

🧰 Changes

This is a weird one! Right now if you have a request body that utilizes examples and have multiple examples within that our example determination for Operation.getParametersToJSONSchema() will now will pick an example from each down the list as it processes property.

For example:

Screen Shot 2023-03-07 at 2 29 16 PM

Reason this is happening is because the schema.examples array we're working with in lib/openapi-to-json-schema is a reference and when we run .shift() on it we effectively remove that example from being used for the next property we're processing JSON Schema for.

🫠

@erunion erunion added the bug Something isn't working label Mar 7, 2023
@erunion erunion requested review from a team, Dashron, julshotal and kanadgupta and removed request for a team March 7, 2023 23:52
Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

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

lmao

@erunion erunion merged commit 7c000e0 into main Mar 8, 2023
@erunion erunion deleted the fix/request-example-example-selection branch March 8, 2023 00:16
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