Skip to content

Conversation

@zdary
Copy link

@zdary zdary commented Nov 17, 2025

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

  • 🐛 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

frantuma and others added 30 commits June 13, 2023 21:46
allow null values for extensions properties in openapi object
ewaostrowska and others added 25 commits August 25, 2025 08:49
Update ServletUtilsTest.java

Previously, I checked "key1" twice. It should check both "key1" and "key2"
…e equality (swagger-api#4975)

* Fix: Prevent redundant schema resolution by fixing AnnotatedType equality swagger-api#4965 
addresses mutability of ctxAnnotations, JDK/internal annotation noice and order-sensible annotations.
Co-authored-by: daniel-kmiecik <daniel-kmiecik@users.noreply.github.com>
…Overflow (swagger-api#5004)

This PR adds a cycle-detection safeguard to ModelResolver to prevent infinite recursion when resolving array schemas that reference subclasses or self-referential types.

It introduces a dedicated helper method resolveArraySchemaWithCycleGuard(...), which tracks types currently being resolved in a typesBeingResolved set and ensures they are safely added and removed using a try/finally block.

This change fixes StackOverflowError occurrences (issue swagger-api#4852) when generating schemas for models containing recursive array structures, and adds regression tests with JSON fixtures for both OpenAPI 3.0 and 3.1 to verify correct schema output.
Enhanced schema generation by recognizing @nullable annotations as nullable and adding "null" to the type array in OpenAPI 3.1. Introduced a test case to validate the behavior and ensured backward compatibility with explicit @Schema annotations.
return schema.nullable();
}
if (annotations != null) {
for (Annotation ann : annotations) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this loop needed?

if (annotations != null) {
    return Arrays.stream(annotations).anyMatch(annotation ->
                NULLABLE_ANNOTATIONS.contains(annotation.annotationType().getSimpleName()));
 }
@zdary zdary changed the base branch from master to backslashes-issue January 31, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment