Skip to content

Conversation

@kliushnichenko
Copy link
Contributor

Adding support for Jakarta @DefaultValue annotation in MVC and open-api

@jknack
Copy link
Member

jknack commented Jan 15, 2026

thank you, I missed DefaultValue from jakarta.

but tell me, how:

@QueryParam("pageSize") @DefaultValue("20") int pageSize

is better than:

@QueryParam("20") int pageSize

even:

@QueryParam("page-size") @DefaultValue("20") int pageSize

vs:

@QueryParam(name="page-size", value="20") int pageSize

while there is no difference when setting just the name:

@QueryParam("page-size") int pageSize

vs:

@QueryParam(name="page-size") int pageSize

The jakarta version always force you to put the name there, this is OK for old framework that relay on reflection, but for a code generator tool, like jooby mvc doesn't make sense.

Anyway... what do you think of adding the jakarta @Named?

@Named("page-size") @QueryParam("20") int pageSize

@kliushnichenko
Copy link
Contributor Author

@Named("page-size") @QueryParam("20") int pageSize looks good to me in terms of readability and clarity.
But @Named is not a part of jakarta.ws.rs. Do you think it's ok to use jakarta.inject.Named here?

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.

2 participants