Skip to content

Commit

Permalink
fix: remove broken condition-on-itself subschemas for allOf and choices
Browse files Browse the repository at this point in the history
Closes #133
  • Loading branch information
barmac committed Feb 12, 2024
1 parent cdad396 commit 64aa761
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,36 +63,16 @@
]
},
"conditionDependingOnId": {
"anyOf": [
{
"required": [
"property"
],
"properties": {
"property": {
"const": {
"$data": "2/id"
}
}
}
},
{
"required": [
"allMatch"
],
"allMatch": {
"contains": {
"properties": {
"property": {
"const": {
"$data": "2/id"
}
}
}
}
"required": [
"property"
],
"properties": {
"property": {
"const": {
"$data": "2/id"
}
}
]
}
}
},
"allOf": [
Expand All @@ -114,31 +94,6 @@
"required": [ "condition" ]
}
}
},
{
"$comment": "property#condition should not depend on property#id",
"if": {
"required": [
"id",
"choices"
],
"properties": {
"choices": {
"contains": {
"properties": {
"condition": {
"$ref": "#/definitions/conditionDependingOnId"
}
}
}
}
}
},
"then": {
"not": {
"required": [ "choices" ]
}
}
}
],
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,5 @@ export const template = {
]
};

export const errors = [
{
keyword: 'errorMessage',
dataPath: '/properties/0',
schemaPath: '#/allOf/0/items/allOf/1/allOf/0/then/errorMessage',
params: {
errors: [
{
keyword: 'not',
dataPath: '/properties/0',
schemaPath: '#/allOf/0/items/allOf/1/allOf/0/then/not',
params: {},
message: 'should NOT be valid',
emUsed: true
}
]
},
message: 'Invalid condition.property, must be different than property.id'
},
{
keyword: 'if',
dataPath: '/properties/0',
schemaPath: '#/allOf/0/items/allOf/1/allOf/0/if',
params: { failingKeyword: 'then' },
message: 'should match "then" schema'
},
{
keyword: 'type',
dataPath: '',
schemaPath: '#/oneOf/1/type',
params: { type: 'array' },
message: 'should be array'
},
{
keyword: 'oneOf',
dataPath: '',
schemaPath: '#/oneOf',
params: { passingSchemas: null },
message: 'should match exactly one schema in oneOf'
}
];
// TODO(@barmac): should report errors
export const errors = null;
Original file line number Diff line number Diff line change
Expand Up @@ -94,44 +94,5 @@ export const template = {
]
};

export const errors = [
{
keyword: 'errorMessage',
dataPath: '/properties/0',
schemaPath: '#/allOf/0/items/allOf/1/allOf/1/then/errorMessage',
params: {
errors: [
{
keyword: 'not',
dataPath: '/properties/0',
schemaPath: '#/allOf/0/items/allOf/1/allOf/1/then/not',
params: {},
message: 'should NOT be valid',
emUsed: true
}
]
},
message: 'Invalid condition.property, must be different than property.id'
},
{
keyword: 'if',
dataPath: '/properties/0',
schemaPath: '#/allOf/0/items/allOf/1/allOf/1/if',
params: { failingKeyword: 'then' },
message: 'should match "then" schema'
},
{
keyword: 'type',
dataPath: '',
schemaPath: '#/oneOf/1/type',
params: { type: 'array' },
message: 'should be array'
},
{
keyword: 'oneOf',
dataPath: '',
schemaPath: '#/oneOf',
params: { passingSchemas: null },
message: 'should match exactly one schema in oneOf'
}
];
// TODO(@barmac): should report errors
export const errors = null;

0 comments on commit 64aa761

Please sign in to comment.