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

Parsing empty parameter to non String type should become null instead of 404 #42414

Closed
blazmrak opened this issue Aug 8, 2024 · 4 comments
Closed
Labels
area/rest kind/enhancement New feature or request triage/duplicate This issue or pull request already exists

Comments

@blazmrak
Copy link

blazmrak commented Aug 8, 2024

Description

Right now, parsing of non String types throws 404 if parameter is empty (e.g. ?param= and @RestQuery LocalDate param), but works when param is omitted or when param is the correct value.

This is technically correct and kind of expected, but it clashes with default browser behavior, which sends empty params in the request. In my opinion it would be better if empty value would be treated as null for non String types.

Implementation ideas

One way of doing this that would not break Jakarta spec and be backwards compatible is to add a configuration option/annotation and update the converters.

It is probably important to make this configuration option work for a subset of the default known types, that fail when parsing empty String, not for all non String types, as this might cause issues for custom types.

@blazmrak blazmrak added the kind/enhancement New feature or request label Aug 8, 2024
@geoand
Copy link
Contributor

geoand commented Aug 9, 2024

@FroMage WDYT?

@FroMage
Copy link
Member

FroMage commented Aug 9, 2024

Dupe of #40833?

@FroMage
Copy link
Member

FroMage commented Aug 9, 2024

Oh, the other is for form params, and this one for query params. But it's the same issue, really.

@geoand
Copy link
Contributor

geoand commented Aug 9, 2024

Ah, good point!

@geoand geoand added the triage/duplicate This issue or pull request already exists label Aug 9, 2024
@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/enhancement New feature or request triage/duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants