Skip to content

Examples lost when it begins with number #3221

@ragutsky

Description

@ragutsky

Describe the bug

If examples start with a number and not wrapped to double quotes, only number is preserved and rest part is omitted.

To Reproduce
Steps to reproduce the behavior:

  1. Add some DTO with field like:
        @Schema(description = "Address line 1", example = "170 Oaklands Grove")
        String addressLine1
  1. Check yaml:
        address_line1:
          type: "string"
          description: "Address line 1"
          example: 170
  • What version of spring-boot you are using?
    Spring Boot 4.0.2
  • What modules and versions of springdoc-openapi are you using?
    Springdoc 3.0.1
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    Actual:
        address_line1:
          type: "string"
          description: "Address line 1"
          example: 170

Expected:

        address_line1:
          type: "string"
          description: "Address line 1"
          example: "170 Oaklands Grove"

Expected behavior

Example in yml should have the value defined in annotation 170 Oaklands Grove, not just 170.
Expected:

        address_line1:
          type: "string"
          description: "Address line 1"
          example: "170 Oaklands Grove"

Additional context

If wrapped to double quotes it works fine

        @Schema(description = "Address line 1", example = "\"170 Oaklands Grove\"")
        String addressLine1,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions