Skip to content

'required' attribute does not work in @Schema #1468

Closed
@hokjoung

Description

@hokjoung

Describe the bug
the required attribute for the @Schema is not reflected on the openapi response.
any help is appreciated

untitled_and_untitled_and_payments-api_–_PaymentController_kt__payments-api_api_main__and_Swagger_UI

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using?
    2.3.7.RELEASE

  • What modules and versions of springdoc-openapi are you using?
    dependency("org.springdoc:springdoc-openapi-ui:1.5.13")
    dependency("org.springdoc:springdoc-openapi-kotlin:1.5.13")

  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    actual:

{
   ...
   "PaymentKeyInRequest":{
      "required":[
         "amount",
         "customerEmail",
         "extraInfo",
         "orderId",
         "orderName",
         "productCode",
         "productDiscountCode",
         "productExpirationMonth",
         "productExpirationYear",
         "productNumber",
         "taxFreeAmount"
      ],
      "type":"object",
      "properties":{
         "amount":{
   ...
}

expected:

{
   ...
   "PaymentKeyInRequest":{
      "required":[
         "amount",
         "productCode",
         "customerName",
         "customerIdentityNumber"
      ],
      "type":"object",
      "properties":{
         "amount":{
   ...
}

Expected behavior

  • the value specifically given for the required attribute should be the final value for the field

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions