Skip to content

How do we provide descriptions for parameters? #103

Open
@arajendiran

Description

@arajendiran

For a data class defined as follows,

import io.swagger.v3.oas.annotations.Parameter
import io.swagger.v3.oas.annotations.media.Schema

// ...

@Schema(description = "Test DateWrapper Description")
   data class DateWrapper(
       @Parameter(description = "test description")
       val startDate: LocalDate,
       val endDate: LocalDate? = null,
)

the output of the json is as follows.

"DateWrapper": {
        "description": "Test DateWrapper Description",
        "type": "object",
        "properties": {
          "endDate": {
            "format": "date",
            "type": "string"
          },
          "startDate": {
            "format": "date",
            "type": "string"
          },
        }
      },

I am trying to provide a description for the Property (startDate) in the Schema. Could you provide some guidance on how to do achieve this? I am looking for an output as follows:

"DateWrapper": {
        "description": "Test DateWrapper Description",
        "type": "object",
        "properties": {
          "endDate": {
            "format": "date",
            "type": "string"
          },
          "startDate": {
            "format": "date",
            "type": "string",
            "description" : "test description"
          },
        }
      },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions