Skip to content

Why does Schema(description="foo") change generated openapi enum type to type: object?  #4625

@cswarth

Description

@cswarth

An enum property with Schema description generates an incorrect open api yaml specification, with 'allOf' and 'type: object' that should not be there,

@Data
public class ColumnNameListRequest  {
  @Schema(description="foo")
  private DataGranularity granularity;
}

generates,

    ColumnNameListRequest:
      type: object
      properties:
        granularity:
          allOf:
          - $ref: '#/components/schemas/DataGranularity'
          - type: object
            description: foo

but if I remove description="foo" the generated signature looks correct,

@Data
public class ColumnNameListRequest  {
  @Schema(description="foo")
  private DataGranularity granularity;
}

generates,

    ColumnNameListRequest:
      type: object
      properties:
        granularity:
          $ref: '#/components/schemas/DataGranularity'

Why does the generated openapi type depend on whether I supply a "description" or not?

src.zip

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