swagger-api / swagger-api/swagger-core
2.2.30 - @NotNull(jakarta.validation.constraints.NotNull) assigned to a group should treat field as mandatory
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
hi! just migrated from 2.2.28 to 2.2.30 and now @NotNull (jakarta.validation.constraints.NotNull) doesn't generate the required parameter when assigning a validation group.
Using the @NotNull alone generates the expected spec and adds it as required.
DTO
import jakarta.validation.constraints.NotNull;
import java.util.List;
public class Request {
private boolean booleanProperty;
@NotNull(groups = SomeClass.class, message = "required")
private NotNullPropertyEnum notNullProperty;
@CustomValidator(groups = SomeClass.class)
private List<String> arrayProperty;
2.2.28
Request:
required:
- notNullProperty
type: object
properties:
booleanProperty:
type: boolean
notNullProperty:
type: string
enum:
- ENUM1
- ENUM2
arrayProperty:
type: array
items:
type: string
2.2.30
Request:
type: object
properties:
booleanProperty:
type: boolean
notNullProperty:
type: string
enum:
- ENUM1
- ENUM2
arrayProperty:
type: array
items:
type: string
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the provided Request DTO and compare the generated OpenAPI output for versions 2.2.28 and 2.2.30. Trace how the jakarta.validation.constraints.NotNull annotation and its validation group are handled; done means the grouped notNullProperty appears under the schema's required list without regressing the other properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100