-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No nested schema for composed property #57
Comments
I think I understand what's the issue. The lib doesn't seem to expect multiple types inside a |
Hi @giann, {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "string"
} This schema can't be represented as a object. If this schema is passed to the generator it would be skipped. Due to the composition the generator starts to generate nested objects for each branch of the composition and fails on the first branch as the branch doesn't provide a nested schema which is representable as an object. I think the error message could be more meaningful. Your schema is a valid JSON-schema but it can't be represented as a object. |
Thanks for the quick answer @wol-soft |
yes, if you wrap the composition into an object, let's say like in the following example, the generator will generate an object with the address property which is either a string or an instance of the nested object containing the properties from the second {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"address": {
"oneOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"address": { "type": "string" },
"specialDelivery": { "type": "string" },
"zipCode": { "type": "string" },
"city": { "type": "string" }
},
"additionalProperties": false
}
]
}
},
"required": [ "address" ]
} Also a reference to the schema from another schema (eg. |
I see thanks a lot! |
Describe the bug
With this schema I get this error I don't understand:
No nested schema for composed property Address in file Adress.json found
Expected behavior
I don't see anything wrong with this schema so I'd expect it to generate the appropriate class.
Schema
No custom
GeneratorConfiguration
.Version:
0.22.0
The text was updated successfully, but these errors were encountered: