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

quarkus-smallrye-openapi does not output STRING type when object #35222

Closed
upivcom opened this issue Aug 5, 2023 · 4 comments
Closed

quarkus-smallrye-openapi does not output STRING type when object #35222

upivcom opened this issue Aug 5, 2023 · 4 comments
Labels

Comments

@upivcom
Copy link

upivcom commented Aug 5, 2023

Describe the bug

i have the following code:

@NotNull(message = "discount type must not be null")
@Schema(type = SchemaType.STRING, description = "Discount type", example = "INVOICE_EXPENSE",
enumeration = {"INVOICE_EXPENSE", "CONTRIBUTION_MARGIN", "INVESTMENT"})
private DiscountType type;

the DiscountType is enum

however when I run the build the yaml generates like this:
roperties:
type:
allOf:
- $ref: '#/components/schemas/DiscountType'
- description: Discount type
enum:
- INVOICE_EXPENSE
- CONTRIBUTION_MARGIN
- INVESTMENT
example: INVOICE_EXPENSE
nullable: false

if I set the object type then the type is set in the yaml correctly, but with string it does not generate and with that I am having problems importing the yaml in the redocly, apparently it is ignoring the STRING type and if I put it in the yaml manually it works, how can i fix this

Expected behavior

when I put the type STRING the yaml is generated like this:

roperties:
type:
allOf:
- $ref: '#/components/schemas/DiscountType'
- description: Discount type
enum:
- INVOICE_EXPENSE
- CONTRIBUTION_MARGIN
- INVESTMENT
example: INVOICE_EXPENSE
nullable: false
type: string

Actual behavior

roperties:
type:
allOf:
- $ref: '#/components/schemas/DiscountType'
- description: Discount type
enum:
- INVOICE_EXPENSE
- CONTRIBUTION_MARGIN
- INVESTMENT
example: INVOICE_EXPENSE
nullable: false

How to Reproduce?

No response

Output of uname -a or ver

Linux 09VM9QBRB05627 5.19.0-50-generic #50-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 10 18:24:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux uilliampiva@09VM9QBRB05627

Output of java -version

openjdk version "11.0.19" 2023-04-18 LTS

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.9.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@upivcom upivcom added the kind/bug Something isn't working label Aug 5, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 5, 2023

/cc @EricWittmann (openapi), @Ladicek (smallrye), @MikeEdgar (openapi), @jmartisk (smallrye), @phillip-kruger (openapi,smallrye), @radcortez (smallrye)

@mjossany
Copy link

mjossany commented Aug 7, 2023

Any solution to this situation? I have exactly the same problem.

@MikeEdgar
Copy link
Contributor

MikeEdgar commented Aug 7, 2023

It's a workaround, but instead of type = SchemaType.STRING you can try implementation = String.class and it should give the expected results. You should not see the $ref in that case.

@upivcom
Copy link
Author

upivcom commented Aug 7, 2023

it worked great, thank you @MikeEdgar

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

No branches or pull requests

4 participants