-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
disregarding the invalid usage of allOf and additionalProperties: false,
if the root has type: object defined with allOf, the --fix command adds an unnecessary unconstrained subschema to the allOf. Can this be removed? Is there a reason we need to also add this? I don't believe the schema produces a different output if it were to be removed.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"allOf": [
{ "$ref": "#/definitions/thing" },
{
"type": "object",
"properties": { "name": { "type": "string" } }
}
],
"definitions": {
"thing": {
"type": "object",
"properties": {
"age": { "type": "integer" }
}
}
}
}
--fix
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
}
},
"allOf": [
{
"$ref": "#/definitions/thing"
},
{
"type": "object"
}
],
"definitions": {
"thing": {
"type": "object",
"properties": {
"age": {
"type": "integer"
}
}
}
}
}
With the root definition removed, it produces the expected results.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"allOf": [
{
"$ref": "#/definitions/thing"
}
],
"definitions": {
"thing": {
"type": "object",
"properties": {
"age": {
"type": "integer"
}
}
}
}
}Metadata
Metadata
Assignees
Labels
No labels