openapi2conv: preserve x-fields when converting from v2 to v3 #1092
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.
Fixes #1091
When converting OpenAPI v2 specifications to v3 using openapi2conv.ToV3(), schema property-level extensions such as x-order were being lost during the conversion process.
Root Cause
The issue was in the ToV3SchemaRef function where schema.Extensions was assigned to v3Schema.Extensions instead of schema.Value.Extensions.
Changes
Impact
This fix ensures that property-level extensions are now correctly preserved when converting from OpenAPI v2 to v3, which is important for field ordering, custom validation rules, code generation hints, and other custom metadata.