swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

5001: Add support for @Nullable annotations in OpenAPI 3.1 schemas

Open zdary opened this issue 3 months ago • 0 comments

Pull Request

Thank you for contributing to swagger-core!

Please fill out the following information to help us review your PR efficiently.


Description

Enhanced schema generation by recognizing

  • @Nullable annotations as nullable and adding "null" to the type array in OpenAPI 3.1.
  • nullable = true in schema and adding "null" to the type array in OpenAPI 3.1.

Introduced a test case to validate the behavior and ensure backward compatibility with explicit @Schema annotations.

Fixes: #5001

Type of Change

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

Checklist

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

Screenshots / Additional Context

zdary avatar Nov 17 '25 01:11 zdary