Skip to content

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

Closed

Description

@eldarj

Related to this swagger-api/swagger-inflector#371 and these PRs I suppose:

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?

Activity

  1. ewaostrowska commented on Feb 26, 2026

    @ewaostrowska
    Contributor

    Hi! This issue should be resolved in #5060 and will be part of the next release.

  2. eldarj commented on Feb 26, 2026

    @eldarj
    Author

    Thank you @ewaostrowska

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions