swagger-api / swagger-api/swagger-codegen-generators
`@NotNull` is added by default for fields that are not required
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
Given the following step:
Swagger Definition:
address_start_date:
type: string
format: 'date-time'
example: "2011-12-03 10:15:30"
description: |
Start Date for address
swagger-codegen-maven-plugin 3.0.56 generates the following model:
/**
* Start Date for address
* @return addressStartDate
**/
@Valid
@Schema(description = "Start Date for address ")
public LocalDateTime getAddressStartDate() {
return addressStartDate;
}
While swagger-codegen-maven-plugin 3.0.57 generates this:
/**
* Start Date for address
* @return addressStartDate
**/
@NotNull // <--- This is added by default
@Valid
@Schema(description = "Start Date for address ")
public LocalDateTime getAddressStartDate() {
return addressStartDate;
}
It seems that this is what introduced with https://github.com/swagger-api/swagger-codegen-generators/pull/1291
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
Compare the generated model output from swagger-codegen-maven-plugin 3.0.56 and 3.0.57, then inspect the change referenced in swagger-api/swagger-codegen-generators pull request 1291. The fix is complete when fields without a required declaration no longer receive @NotNull in the generated Java model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100