Open netanel-mce opened 1 year ago
@domoritz what you want to got for following type, when flag noExtraProps
turn on?
Type:
type Sub = {
subChild: string;
};
type Main = {
mainChild: Main & Sub;
}
if we generating a schema like this:
{
"$ref": "#/definitions/Main",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"Sub": {
"additionalProperties": false,
"type": "object",
"properties": {
"childSub": {
"type": "number"
}
}
},
"Main": {
"additionalProperties": false,
"properties": {
"childMain": {
"allOf": [
{
"$ref": "#/definitions/Main"
},
{
"$ref": "#/definitions/Sub"
}
]
}
},
"required": [
"childMain"
],
"type": "object"
}
}
}
so we will got the issue like #107
but we cannot merge the schemas, because it recursive type, so we must to use in $ref
I middle in write a PR for resolve this issue, but your should to answer of this product question
@domoritz I tried this case also on vega but I got this schema
{
"$ref": "#/definitions/Foo",
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"Foo": {
"additionalProperties": false,
"properties": {
"childFoo": {
"additionalProperties": false,
"properties": {},
"type": "object"
}
},
"required": [
"childFoo"
],
"type": "object"
}
}
}
without recursive.
So please help me to decide what we want to be the output for this case.
@erezMCE what you think?
this type is endless, and no data to be valid for this type. so we not support it.
thanks @erezMCE
Facing this as well, any workarounds? I'm ok with having a max-depth option if all else fails? (Mainly prisma types are problematic)
Steps to Reproduce: version: 0.59.0 create schema for
Foo
type, and turn on the flagnoExtraProps
.The error: Maximum call stack size exceeded.
Because we merging the object, instead of use in
allOf
(see #107), in recursive type we trying to build schema for parent and child again and again.