-
Notifications
You must be signed in to change notification settings - Fork 9
fix: preserve metadata in swagger to openapi upgrade #84
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
Merged
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
Contributor
📊 Test Coverage ReportCurrent Coverage: Coverage Change: 📈 +.1% (improved) Coverage by Package
📋 Detailed Coverage by Function (click to expand)
Generated by GitHub Actions |
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.
Overview
Enhances the Swagger 2.0 to OpenAPI 3.0 upgrade function to preserve metadata that was previously being lost during conversion, particularly from the Petstore example document.
Key Changes
Swagger Upgrade Enhancements (
swagger/upgrade.go)External Documentation Preservation
convertExternalDocs()helper to convert external documentationexternalDocsnow properly convertedexternalDocspreserved on tagsOperation Security Requirements
convertOperation()to preserve operation-level security constraintsEnhanced Parameter Schema Conversion
schemaForSwaggerParamType()to preserve:Critical XML Metadata Fix
rewriteRefTargets()to preserve metadata when rewriting references$refTest Coverage
TestUpgrade_Petstore_YAML_Successwith complete expected outputTestUpgrade_XML_Metadata_On_Ref_Items_YAML_Successfor XML metadata preservationTestSchema_XML_Metadata_On_Ref_Items_RoundTrip_Successto verify oas3 layer serializationTesting
mise ci # All checks passImpact
The Swagger to OpenAPI upgrade now preserves all critical metadata from source documents, ensuring no information is lost during the conversion process. This is particularly important for complex API specifications like Petstore that use external documentation, security requirements, validation constraints, and XML metadata.