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

Query with null value included #371

Closed
DipDevStudio opened this issue Oct 13, 2022 · 4 comments · Fixed by #372
Closed

Query with null value included #371

DipDevStudio opened this issue Oct 13, 2022 · 4 comments · Fixed by #372
Assignees
Labels
enhancement New feature or request

Comments

@DipDevStudio
Copy link

In the last release 5.0.1 in query, the value is null - URL request was configurated with an empty value.

/categories?offset=&limit=

In the previous release, 5.0.0, these queries were not included.

/categories

Example:

@Get(path: 'categories')
  Future<Response<DtoPagination<DtoCategory>>> categories(
    @Header('Request-Service-Location') String service, {
    @Query('offset') int? offset,
    @Query('limit') int? limit,
  });
@techouse
Copy link
Collaborator

techouse commented Oct 13, 2022

That is by design #364 as most if not all backends ignore it anyway. The previous way of truncating it was wrong.

@DipDevStudio
Copy link
Author

DipDevStudio commented Oct 13, 2022

Ok, but Laravel (PHP) don't ignore it.
It perceives as an empty text (string - ""), but the number (integer) is required - an exception occurs.
So, this method is also not entirely correct and is redundant - data is transmitted that can only sometimes be useful.

It would be correct to add a key to the annotation that is responsible for ignoring or not such data.
But if it is difficult to do this through the annotation, then you can add it to the chopper settings

@techouse
Copy link
Collaborator

techouse commented Oct 13, 2022

I could add an annotation to @Method to truncate null query parameters, yes.

@techouse
Copy link
Collaborator

Check #372

@techouse techouse added the enhancement New feature or request label Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants