Skip to content

@NotNull is added by default for fields that are not required  #1295

Description

@yeikel

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 #1291

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions