Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cswarth opened this issue Mar 5, 2024 · 0 comments

Comments

@cswarth
Copy link

cswarth commented Mar 5, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant