Repository navigation
fix(openapi): preserve Swagger response examples - #118
Open
xujiantop-crypto wants to merge 1 commit into
Open
xujiantop-crypto wants to merge 1 commit into
xujiantop-crypto wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Swagger 2 response examples are stored in
responses.<status>.examplesas a MIME-type-to-value map. The converter currently copies the response schema but drops those examples, so generated tools lose the sample response values supplied by the API.Normalize the map values into an examples list before merging them with schema-level examples. Keep literal objects intact, including payload fields named
value,$ref, orexternalValue, and reuse the existing stable, type-aware deduplication.This addresses only item 3 of #98. The request-body and parameter-content gaps remain outside this change. Refs #98.
Validation on Windows with Python 3.13.12:
countries.trevorblades.com. That test passed on its first rerun with the same code and environment.git diff --checkpassed.The new tests use in-memory Swagger documents and no external services. They cover raw values (including false, zero, empty values and null), serialization, schema references, multiple MIME types, response-status selection, and deduplication without collapsing distinct JSON types. Linux, macOS and the other Python versions in CI have not been run locally.