fix(openapi): use first user request example when response example name doesn't match #11771
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Refs: Slack thread from kenny
Fixes a bug where response-level examples in OpenAPI specs generated an extra example with
requestBody: undefined. This caused response-level examples to produce 5 examples instead of 4 (matching schema-level examples).Link to Devin run: https://app.devin.ai/sessions/b6850d32576643dbb2fce173abffee0b
Requested by: kenny
Changes Made
generateEndpointExample.tsto prioritize using the first user request example when a response example name doesn't match any request example namerequestBody: undefined)Testing
Updates Since Last Revision
examples-endpoint-level.json,examples-endpoint-level-named.json) to reflect the fixReview Checklist
displayName(instead of response example name) is the desired behavior when there's no name matchfirstUserRequestNameas used inrequestExamplesUseddoesn't cause unintended side effects increateExamplesForRemainingUserRequests