You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As described in the docsdeepObject style should be applied to parameter if it's an object. It works as expected for single params in controller like QueryParams('param') but not when all params are combined into one model QueryParams()
Example
@Generics('T')exportclassQueryParamBetweenFilter<T>{
@Description('Greater than constraint')
@Property('T')publicgt?: T;
@Description('Greater than or equal constraint')
@Property('T')publicgte?: T;
@Description('Less than constraint')
@Property('T')publiclt?: T;
@Description('Less than or equal constraint')
@Property('T')publiclte?: T;}exportclassFilters{
@GenericOf(number().integer())publicparam?: QueryParamBetweenFilter<number>;}
@Controller({path: '/test'})classTestDeepObjectCtrl{
@Get('/works')publicget(@QueryParams("param") @GenericOf(number().integer())q: QueryParamBetweenFilter<number>){}
@Get('/doesNotWork')publicget(@QueryParams()filters: Filters){}}
Acceptance criteria
Using QueryParams with Model should produce deepObject style for object query params present in the Model
The text was updated successfully, but these errors were encountered:
@tsed/schema doesn't detect the model with deeps property in this case. But the given example is too complex because it use generics.
I suggest to create a simpler use case with some rules/comments:
classField{type: string;value: string;}exportclassQueryParamsComplexModel{
@CollectionOf(string)publicselect: string[];// this prop can trigger a deepObject style but works without eg: "select=test&select=test2" or "select[0]=test&select[1]=test2"
@CollectionOf(Field)publicfields: Fields[];// this prop must trigger a deepObject style eg "fields[type]=color&fields[value]=yellow"}exportclassQueryParamsPageModel{publicpage: number;// this prop shouldn't trigger a deepObject style}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Information
As described in the docs
deepObject
style should be applied to parameter if it's an object. It works as expected for single params in controller likeQueryParams('param')
but not when all params are combined into one modelQueryParams()
Example
Acceptance criteria
QueryParams
with Model should producedeepObject
style for object query params present in the ModelThe text was updated successfully, but these errors were encountered: