Skip to content

Conversation

AnderData
Copy link

Description

Fixes: #4967

Type of Change

  • 🐛 Bug fix

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)

@NotNull
public Long modeNotRequiredWithAnnotation;

@Schema(description = "mode not required with annotation for NotBlank", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@AnderData Please also add the same cases with RequiredMode.REQUIRED to check if your change works as expected.

@daniel-kmiecik
Copy link
Collaborator

daniel-kmiecik commented Oct 6, 2025

@AnderData The added tests look good overall, but they don’t seem to cover all relevant combinations of annotations and types. It would be helpful to include additional cases to make sure the new behavior is fully validated.

Specifically, please consider adding tests for:

  • @NotNull combined with @notblank / @notempty (to confirm they still produce required = true);

  • Collection types (List, Set) annotated with @notempty, verifying that they generate appropriate schema constraints (e.g. minItems);

  • String fields annotated with both @notblank and @SiZe, ensuring that both restrictions are reflected in the resulting schema.

This would improve confidence that the change doesn’t introduce regressions or subtle differences in how these annotations interact.

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]: RequiredMode.NOT_REQUIRED is not respected by properties annotated with @NotBlank and @NotEmpty
2 participants