Closed liorzmetis closed 2 years ago
Thank you, that appears to be something that is not easily done yet. One possible implementation would be to add a customizer function argument to @JoiSchemaOption()
, similar to the way it works on @JoiSchema()
. That function would allow arbitrary customizations of the constructed object schema.
e.g.
@JoiSchemaOptions({}, (schema) => schema.or('prop1', 'prop2')
Would that cover your case?
Another way to do it would be a separate decorator, e.g.
@JoiSchemaCustomizer((schema) => schema.or('prop1', 'prop2'))
That would avoid mixing different concerns. I am leaning towards that one.
Added in new v1.8.0.
I would like to define 'or' when using DTO classes
vs