use anyof for unions with type and consts
sometimes i write some default values in typescript:
dpi?:number|72|96;
which should generate:
"dpi": {
"anyOf": [
{
"type": "number"
},
{
"type": "number",
"enum": [
72,
96
]
}
]
},
currently it only generates:
"dpi": {
"type": "number"
},
https://github.com/YousefED/typescript-json-schema/blob/master/typescript-json-schema.ts#L936
@domoritz should i create a flag for this? (not default) useAnyOfEnum
That would be great. Your flag sounds good as there are more cases beyond numbers (e.g. string, boolean) that should also be supported.
@domoritz how can i add tests only with this flag? Currently i see no options for this.
You need to add the flag to the options and pass that into the test case you add.
@domoritz i found out: Typescript dont use this values:
so the only solutions would be a comment:
/**
* @anyOfEnum number|96|72
*/
or something like this?
/**
* @type number|96|72
*/