samchon / nestia

NestJS Helper Libraries + TypeScript OpenAPI generator
https://nestia.io/
MIT License
1.85k stars 95 forks source link

Field specialization for the request query message #139

Closed ilterugur closed 2 years ago

ilterugur commented 2 years ago

Error on CitiesController.findAll(): parameter countryId is specifying a field countryId of the request query message, however, Nestia does not support the field specialization for the request query message. Erase the CitiesController.findAll()#countryId parameter and re-define a new decorator accepting full structured message.

I'm getting this error. Will nestia support field specialization for the request query message? I have custom decorators built for query parameters, nestia seems promising to me and i want to be able to use them with nestia

SkyaTura commented 2 years ago

@ilterugur could you provide an example setup for reproduction?

samchon commented 2 years ago

I've blocked individual query parameter when implementing nestia@v1, because I hoped developers to define strict DTO.

When the individual query parameter being allowed, nestia must always consider it as a string time. However, as you know, the query parameter can be ommitted if client does not use it. Using an optional string type (paramName?: string) can be an alternative way, but it can be placed only at the backward position of parameters.

Such ambiguity is the reason why I've not supported such individual query parameter.

@Query("paramName") // --NOT ALLOWED
@Query() input: SomeDTO // --ALLOWED

However, many people want the @Query("paramName") feature.

It already dangerous, but I'll support the individual query parameter and just print warning message, instead.

samchon commented 2 years ago

@ilterugur Upgrade to 3.0.13, then it will be.