-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Description
If I have a schema like:
"rings": {
"type": "array",
"description": "Array of the deployment ring object.",
"items": {
"anyOf": [
{
"$ref": "#/definitions/deploymentRing"
}
]
}
}In a sense, it's equivalent to:
"rings": {
"type": "array",
"description": "Array of the deployment ring object.",
"items": {
"type": "object",
"$ref": "#/definitions/deploymentRing"
}
}For users that generate Go types using a JSONSchema they do not control, the use of anyOf in the above example will generate []interface{}, which is unfortunate and very much so not ergonomic, either on generation or parsing. Would it be acceptable to generate a Go struct in these cases with a definite type for the slice, even if that is not perfectly what the author of the JSONSchema intended?
I am not sure, but it seems like there may be some other tool that generates these "loose" JSONSchemas with anyOf array items with only one type, perhaps also a bug in that generator. Would be awesome to work around such cases on the consumer end with this tool.
Metadata
Metadata
Assignees
Labels
No labels