Skip to content

Fail to have both allOf and anyOf as properties in schema #184

Description

@cdanger

I tried the official workaround for re-using schemas with additionalProperties=false in draft 6.
In my case, the relevant part is:

{
	"$schema": "http://json-schema.org/draft-06/schema",
...
	"definitions": {
...
"Match": {
			"type": "object",
			"allOf": [
				{"properties": {
					"matchFunction": { "type": "string", "format": "uri" },
					"attributeValue": {
									"$ref": "common.schema.json#/definitions/AttributeValueType"
								}
				}},
				{
					"oneOf": [
						{
						"properties": {
								"attributeDesignator": { "$ref": "#/definitions/AttributeDesignator"}
						}
						,
							"required": [
								"attributeDesignator"
							]
						},
						{"properties": {
								"attributeSelector": {
							"$ref": "#/definitions/AttributeSelector"}
							},
							
							"required": [
								"attributeSelector"
							]
						},
						{
							"properties": {
								"variableRef": {
									"$ref": "#/definitions/VariableReference"
								}
							},
							"required": [
								"variableRef"
							]
						}
					]
				}
			],
			"anyOf": [
				{
            			"propertyNames": {"enum": ["matchFunction", "attributeValue"]}
        		},
        		{
            			"propertyNames": {"oneOf": [
            				{"enum": ["attributeDesignator"]}, {"enum": ["attributeSelector"]}, {"enum": ["variableRef"]} 
            				]} 
        		}
			]
		}
...
}
}

I get this error:

Caused by: org.everit.json.schema.SchemaException: #/definitions/Match: expected at most 1 of 'allOf', 'anyOf', 'oneOf', 2 found

Is this workaround supposed to work with the json-schema library ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions