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

Default values on @QueryParam #118

Open
choffa opened this issue Nov 18, 2021 · 4 comments
Open

Default values on @QueryParam #118

choffa opened this issue Nov 18, 2021 · 4 comments

Comments

@choffa
Copy link

choffa commented Nov 18, 2021

Would it be possible to support default values for optional query params? Either as a value in the @QueryParam annotation, or by using a default value from the constructor?

@Wicpar
Copy link
Collaborator

Wicpar commented Nov 30, 2021

the obvious way to do it if you are willing to do a one liner is to do something like this, with params.param as a nullable type:
val param = params.param ?: getDefaultValue()

@choffa
Copy link
Author

choffa commented Dec 1, 2021

Yes, that is what I am doing today. I was more interested in knowing if there is a way to set the default field in the schema, as described here or if you would be interested in implementing such a feature :)

@Wicpar
Copy link
Collaborator

Wicpar commented Dec 1, 2021

If you want to do a pr to add it i would accept it :)

@HuiiBuh
Copy link

HuiiBuh commented Feb 8, 2022

I am really interested in contributing (especially #122), but I am having some problems understanding the setup.

Where exactly does the collection of the schemas happen and how do they get collected. It does not seem to be near the route functions which handle the requests.

I think I am looking for some basic description which describes the work flow involved in creating the OpenAPI file

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

3 participants