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

Reusable enums are not working #542

Open
alejandrod-f opened this issue Feb 15, 2023 · 1 comment
Open

Reusable enums are not working #542

alejandrod-f opened this issue Feb 15, 2023 · 1 comment

Comments

@alejandrod-f
Copy link

alejandrod-f commented Feb 15, 2023

Hi!
I can not find a way to get enums to be generated in a way that are reused.
Based on some research, looks like we should be using @Schema(enumAsRef = true). But, it does not work.
I'd actually suggest that maybe this should be a global option. Wondering why is not the default... in the code you usually do not repeat the enums.

Spec ref: https://swagger.io/docs/specification/data-models/enums/

  • Example
object SomeType extends Enumeration {
  type SomeType = Value```

I tried these both:

  case class SomeClass(someType: SomeType.SomeType)

  case class SomeClass(someType: SomeType.Value)

They both generate something like:

"someType" : {
  "type" : "string",
  "enum" : [ "Value1", "Value2" ]
},

expected:

"someType" : {
  "$ref: '#/components/schemas/SomeType"
},
@Javakky-pxv
Copy link
Collaborator

@alejandrod-f
We are currently reviewing it.
It may take some time, but we plan to address it.

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

2 participants