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

fix: enumName is ignored in @Api[Param|Query|Header] #2734

Merged
merged 3 commits into from
Jan 15, 2024

Conversation

lucas-gregoire
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

image

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Using enumName in @Api[Param|Query|Header] is not making a reference to the enum model in the Openapi specification.

image => image

When removing @Param('type') type: LettersEnum, the enum is correctly referenced:

image

The expected behavior should be like this last screen in both cases (with or without a param in the method).

What is the new behavior?

In SchemaObjectFactory.createFromModel, when we get a primitive type infered from method parameter metadata, it skips the call of createEnumParam which handles enums references via $ref.

Calling it before isPrimitiveType did the job.
BTW, I also improved the implementation of ApiParam to make it look like more like ApiQuery by using addEnumSchema

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@lucas-gregoire
Copy link
Contributor Author

Hello @kamilmysliwiec, would it be possible to merge this PR please ?

@kamilmysliwiec
Copy link
Member

LGTM

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

Successfully merging this pull request may close these issues.

4 participants