Open ouyangde opened 6 years ago
It can't be done this way. Think the resolver as a way of getting from a valid JSON schema to an other, depending on the actual value of the JSON instance. So the problem here is that there is no a valid JSON schema that can describe these different types per additional property.
What you can do is refactor your schema to get a conceptually equivalent schema, like for example:
Since this schemas would generate JSON instances with a structure different than your actual one, and in the case you would need to maintain the actual one, you could easily perform a transformation in javascript from the generated data.
In order to ensure that json-forms can generate any form I desired, I tried to write a schema which can generate itself, but failed. Here is my schema:
Here is my resolver function:
I encounter two problems here.
additionalProperties
, since they are all marked by*
.Cannot read property 'type' of undefined