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
But what I have is two level of maps inside each other.
1.) I considered creating a separate object for one map with type, but this also doesn't help, because I can't add type information on a class. e.g.:
@ValidateNested({ each: true })
@Type(() => MyObject)
data?: Map<string, MyObject>;
// Some other file:
// FIXME: Annotations on class level don't work, so no possibility to add inner type information.
export class MyObject extends Map<string, MyDto> {
}
Does anyone know how to do this?
2.) Second workaround would be to manually define the JSONSchema with annotation:
@ValidateNested({ each: true })
// FIXME: Help, how can I correctly add type information for this field?
// @JSONSchema({
// format: 'custom-test',
// type: 'object'
// })
data?: Map<string, Map<string, MyDto>>;
The same issue also occurs with other nested structures, such as arrays inside a map. See also: #74
Is there a simpler way to annotate such complex nested types with routing-controllers-openapi? I have the feeling an annotation could solve this a lot easier for everyone.
It seems impossible to annotate nested maps with type information. Consider this property:
Now if it were only a single map I can correctly tell openapi it should validate the nested objects, and what type they are:
But what I have is two level of maps inside each other.
1.) I considered creating a separate object for one map with type, but this also doesn't help, because I can't add type information on a class. e.g.:
Does anyone know how to do this?
2.) Second workaround would be to manually define the JSONSchema with annotation:
The same issue also occurs with other nested structures, such as arrays inside a map. See also: #74
The documentation didn't mention such specific cases:
https://github.com/typestack/class-transformer#working-with-nested-objects
https://github.com/epiphone/class-validator-jsonschema#validatenested-and-arrays
Thanks for your help!
The text was updated successfully, but these errors were encountered: