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
anyOf may be used on objects to define at least one of these properties is required, but not all of them at the same time, in this case anyOf will be an array of objects with only the required property: Array<{ required: string[] }>. In this case the object properties seems to be being ignored and json2ts outputs { [k: string]: unknown; }[].
I think anyOf should be ignored if it's an array of objects with only the required property.
exportinterfaceProducts{pictures?: {/** * Picture ID (ObjectID) [auto] */_id?: string;/** * Tag to identify object, use only lowercase letters, digits and underscore */tag?: string;normal?: PictureSize;big?: PictureSize1;zoom?: PictureSize2;small?: PictureSize3;}[];}/** * Default image size variant */exportinterfacePictureSize{/** * Image link */url: string;/** * Image size (width x height) in px, such as 100x50 (100px width, 50px height) */size?: string;/** * Alternative text, HTML alt tag (important for SEO) */alt?: string;}/** * Image big size variant */exportinterfacePictureSize1{/** * Image link */url: string;/** * Image size (width x height) in px, such as 100x50 (100px width, 50px height) */size?: string;/** * Alternative text, HTML alt tag (important for SEO) */alt?: string;}/** * Image zoom size variant */exportinterfacePictureSize2{/** * Image link */url: string;/** * Image size (width x height) in px, such as 100x50 (100px width, 50px height) */size?: string;/** * Alternative text, HTML alt tag (important for SEO) */alt?: string;}/** * Image small size variant */exportinterfacePictureSize3{/** * Image link */url: string;/** * Image size (width x height) in px, such as 100x50 (100px width, 50px height) */size?: string;/** * Alternative text, HTML alt tag (important for SEO) */alt?: string;}
The text was updated successfully, but these errors were encountered:
About
anyOf
may be used on objects to define at least one of these properties is required, but not all of them at the same time, in this caseanyOf
will be an array of objects with only therequired
property:Array<{ required: string[] }>
. In this case the objectproperties
seems to be being ignored and json2ts outputs{ [k: string]: unknown; }[]
.I think
anyOf
should be ignored if it's an array of objects with only therequired
property.Example
The following schema:
Is compiled to:
Removing the
anyOf
it's correctly compiled to:The text was updated successfully, but these errors were encountered: