Missing property bug

Hey, I use Angular jsonforms 3.0.0
I have the data:
“methods”: {
“method”: {
“enabled”: true,
“services”: {}
}
}
And I have the validation error:
[
{
“instancePath”: “/methods/method”,
“schemaPath”: “#/properties/methods/properties/method/required”,
“keyword”: “required”,
“params”: {
“missingProperty”: “services”
},
“message”: “must have required property ‘services’”,
“schema”: [
“enabled”,
“services”
],
“parentSchema”: {
“$schema”: “``http://json-schema.org/draft-07/schema#”``,
“title”: “types”,
“type”: “object”,
“properties”: {
“enabled”: {
“type”: “boolean”,
“default”: false,
},
“flow”: {
“type”: “string”,
“enum”: [
“default”
]
},
“services”: {
“$schema”: “``http://json-schema.org/draft-07/schema#”``,
“title”: “services”,
“type”: “object”,
“properties”: {
“service_id”: {
“title”: “Service”,
“type”: “string”,
“pattern”: “[1]{24}$”,
},
“service_type”: {
“type”: “string”,
“enum”: [
“Test1”
]
}
},
“required”: [
“service_id”,
“service_type”
],
“additionalProperties”: false
}
},
“required”: [
“enabled”,
“services”
],
“additionalProperties”: false
},
“data”: {
“enabled”: true,
“services”: {}
}
}
]

Why do I get the error even if I have services object?


  1. a-f\d ↩︎

The schema:

“properties”: {
“methods”: {
“title”: “methods”,
“type”: “object”,
“properties”: {
“method”: {
“$schema”: “``http://json-schema.org/draft-07/schema#”``,
“title”: “types”,
“type”: “object”,
“properties”: {
“enabled”: {
“type”: “boolean”,
“default”: false
},
“flow”: {
“type”: “string”,
“enum”: [
“default”
]
},
“services”: {
“$schema”: “``http://json-schema.org/draft-07/schema#”``,
“title”: “services”,
“type”: “object”,
“properties”: {
“service_id”: {
“title”: “Service”,
“type”: “string”,
“pattern”: “[1]{24}$”,
},
“service_type”: {
“type”: “string”,
“enum”: [
“Test1”
]
}
},
“required”: [
“service_id”,
“service_type”
],
“additionalProperties”: false
}
},
“required”: [
“enabled”,
“services”
],
“additionalProperties”: false
}
},
“minProperties”: 1,
“additionalProperties”: false
}
}


  1. a-f\d ↩︎

Hi @VladislavLinnik,

When I test your JSON Schema

{
  "properties": {
    "methods": {
      "title": "methods",
      "type": "object",
      "properties": {
        "method": {
          "$schema": "http://json-schema.org/draft-07/schema#",
          "title": "types",
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean",
              "default": false
            },
            "flow": {
              "type": "string",
              "enum": ["default"]
            },
            "services": {
              "$schema": "http://json-schema.org/draft-07/schema#",
              "title": "services",
              "type": "object",
              "properties": {
                "service_id": {
                  "title": "Service",
                  "type": "string",
                  "pattern": ".{24}$"
                },
                "service_type": {
                  "type": "string",
                  "enum": ["Test1"]
                }
              },
              "required": ["service_id", "service_type"],
              "additionalProperties": false
            }
          },
          "required": ["enabled", "services"],
          "additionalProperties": false
        }
      },
      "minProperties": 1,
      "additionalProperties": false
    }
  }
}

combined with this data

{
  "methods": {
    "method": {
      "enabled": true,
      "services": {}
    }
  }
}

Then I don’t get the services is missing error as you wrote, instead I get two errors, that both service_id and service_type are missing.

Note that we don’t determine errors ourselves in JSON Forms, instead we delegate to AJV. Can you double check the actual data you handed to JSON Forms?