-
Notifications
You must be signed in to change notification settings - Fork 2.2k
5001: Add support for @Nullable annotations in OpenAPI 3.1 schemas #5018
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
Open
zdary
wants to merge
310
commits into
swagger-api:backslashes-issue
Choose a base branch
from
zdary:5001
base: backslashes-issue
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+27,866
−3,208
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
…g, add skipResolveAppPath
…y setting DEFAULT_VIEW_INCLUSION
allow null values for extensions properties in openapi object
>Co-authored-by: @jochenberger >Co-authored-by: @djankows
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.
| return schema.nullable(); | ||
| } | ||
| if (annotations != null) { | ||
| for (Annotation ann : annotations) { |
There was a problem hiding this comment.
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()));
}
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.
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
Introduced a test case to validate the behavior and ensure backward compatibility with explicit @Schema annotations.
Fixes: #5001
Type of Change
Checklist
Screenshots / Additional Context