Skip to content

Commit

Permalink
meta-schemas: Improve child node checks
Browse files Browse the repository at this point in the history
If a child node has 'patternProperties', those properties also need to be
checked.

If we have a child node, then apply the nodes.yaml schema. Expand the
properties allowed for child nodes and use 'propertyNames' instead to
define the set of properties.

Signed-off-by: Rob Herring <[email protected]>
  • Loading branch information
robherring committed Dec 12, 2019
1 parent 54958da commit b794af3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
14 changes: 14 additions & 0 deletions meta-schemas/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ definitions:
enum: [ boolean, object ]
properties:
$ref: "#/definitions/all-properties"
patternProperties:
$ref: "#/definitions/all-properties"

allOf:
- if:
type: object
properties:
type:
const: object
required:
- type
then:
$ref: "nodes.yaml#"

dependencies:
properties: [ type ]
contains:
Expand Down
22 changes: 14 additions & 8 deletions meta-schemas/nodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ type: object
properties:
type:
const: object
description: {}
properties: {}
patternProperties: {}
additionalProperties: {}
required: {}

propertyNames:
enum:
- type
- description
- dependencies
- properties
- patternProperties
- additionalProperties
- required
- allOf
- anyOf
- oneOf
- $ref

required:
- type
- properties

additionalProperties: false

0 comments on commit b794af3

Please sign in to comment.