Skip to content

fix(converter): keep x-nullable in shared $ref responses#2276

Merged
ewaostrowska merged 2 commits intoswagger-api:masterfrom
esaezgil:bug/2269_fix_lost_xnullable_swagger_2_shared_responses
Apr 15, 2026
Merged

fix(converter): keep x-nullable in shared $ref responses#2276
ewaostrowska merged 2 commits intoswagger-api:masterfrom
esaezgil:bug/2269_fix_lost_xnullable_swagger_2_shared_responses

Conversation

@esaezgil
Copy link
Copy Markdown
Contributor

@esaezgil esaezgil commented Feb 20, 2026

Description

  • Fixes x-nullable vendor extension being lost when multiple endpoints share the same response via $ref during Swagger 2.0 to OpenAPI 3.0 conversion
  • Creates a new map instead of mutating the original, preserving extensions for all endpoints sharing the same response definition
  • Adds a regression test

Fixes: #2269

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor (non-breaking change)
  • 🧪 Tests
  • 📝 Documentation
  • 🧹 Chore (build or tooling)

Checklist

  • I have added/updated tests as needed
  • I have added/updated documentation where applicable
  • The PR title is descriptive
  • The code builds and passes tests locally
  • I have linked related issues (if any)

Screenshots / Additional Context

The convert(vendorExtensions) method mutated the original map when
filtering out x-nullable, x-example, and x-examples extensions.

When multiple endpoints referenced the same response via $ref, the
first conversion removed x-nullable from the shared source object,
causing subsequent conversions to miss it and produce nullable=null.

Create a new map instead of mutating the original to preserve vendor
extensions for all endpoints sharing the same response definition.
@ewaostrowska ewaostrowska force-pushed the bug/2269_fix_lost_xnullable_swagger_2_shared_responses branch from effed28 to 6a32a23 Compare April 14, 2026 13:21
@ewaostrowska ewaostrowska force-pushed the bug/2269_fix_lost_xnullable_swagger_2_shared_responses branch from 2cd175e to b2a2fef Compare April 15, 2026 07:40
@ewaostrowska
Copy link
Copy Markdown
Contributor

@esaezgil thank you for providing fix for this issue! Merging it with minor readability improvements and additional test added :)

@ewaostrowska ewaostrowska merged commit bb8a82c into swagger-api:master Apr 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: x-nullable lost for shared $ref responses during Swagger 2.0 to OAS3 conversion

2 participants