swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Explicilty set request body field example as null, instead of "string" or "null"

Open eldarj opened this issue 2 years ago • 0 comments

Related to this https://github.com/swagger-api/swagger-inflector/issues/371 and these PRs I suppose:

  • https://github.com/swagger-api/swagger-core/pull/3637
  • https://github.com/swagger-api/swagger-parser/pull/1400

I'm using spring boot and I cannot set an example for a given field in a request body as explicitly null

For example:

    @Schema(description = "Some field")
    public String field

always ends up either as "string". I tried passing the defaultValue and nullable args to the annotation, but the best I could get is "null"

Actual:

{
  "field" : "string"
}

or

{
  "field" : "null"
}

Expected:

{
  "field" : null
}

How can I accomplish this?

eldarj avatar May 12 '23 07:05 eldarj