ForgeSchemaValidator Fails in Validating Schemas with Parallel Action or Subroutine elements
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 334
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
The checked-in validation rules don't seem to account for the ability to define parallel actions.
The validation rules only expects one action to be defined: ForgeSchemaValidationRules.json
ForgeSchemaValidator returns validation errors for the following schema:
{
"RootTreeNodeKey": "Root",
"Tree": {
"Root": {
"Type": "Action",
"Actions": {
"EvacuateAction_Evacuate": {
"Action": "EvacuateAction"
},
"NotifyCustomerAction_Evacuate": {
"Action": "NotifyCustomerAction",
"Properties": "Notify customer in parallel with the impact."
}
}
}
}
}
but after removing the parallel action, the validation passes:
{
"RootTreeNodeKey": "Root",
"Tree": {
"Root": {
"Type": "Action",
"Actions": {
"EvacuateAction_Evacuate": {
"Action": "EvacuateAction"
}
}
}
}
}
Validation Errors:
[
{
"Message": "JSON is valid against no schemas from 'oneOf'.",
"LineNumber": 1,
"LinePosition": 25,
"Path": "Root.Tree.Root",
"Value": null,
"SchemaId": "#/definitions/TreeNodeDefinition",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "oneOf",
"ChildErrors": [
{
"Message": "Value \"Action\" is not defined in enum.",
"LineNumber": 1,
"LinePosition": 40,
"Path": "Root.Tree.Root.Type",
"Value": "Action",
"SchemaId": "#/definitions/SubroutineTypeNodeDefinition/properties/Type",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "enum",
"ChildErrors": []
},
{
"Message": "Value \"Action\" is not defined in enum.",
"LineNumber": 1,
"LinePosition": 40,
"Path": "Root.Tree.Root.Type",
"Value": "Action",
"SchemaId": "#/definitions/LeafTypeNodeDefinition/properties/Type",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "enum",
"ChildErrors": []
},
{
"Message": "Value \"Action\" is not defined in enum.",
"LineNumber": 1,
"LinePosition": 40,
"Path": "Root.Tree.Root.Type",
"Value": "Action",
"SchemaId": "#/definitions/SelectionTypeNodeDefinition/properties/Type",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "enum",
"ChildErrors": []
},
{
"Message": "Property 'Actions' has not been defined and the schema does not allow additional properties.",
"LineNumber": 1,
"LinePosition": 51,
"Path": "Root.Tree.Root.Actions",
"Value": "Actions",
"SchemaId": "#/definitions/SelectionTypeNodeDefinition",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "additionalProperties",
"ChildErrors": []
},
{
"Message": "Value \"EvacuateAction\" is not defined in enum.",
"LineNumber": 1,
"LinePosition": 104,
"Path": "Root.Tree.Root.Actions.EvacuateAction_Evacuate.Action",
"Value": "EvacuateAction",
"SchemaId": "#/definitions/LeafNodeSummaryActionDefinition/properties/Action",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "enum",
"ChildErrors": []
},
{
"Message": "Required properties are missing from object: Input.",
"LineNumber": 1,
"LinePosition": 79,
"Path": "Root.Tree.Root.Actions.EvacuateAction_Evacuate",
"Value": [
"Input"
],
"SchemaId": "#/definitions/LeafNodeSummaryActionDefinition",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "required",
"ChildErrors": []
},
{
"Message": "Value \"NotifyCustomerAction\" is not defined in enum.",
"LineNumber": 1,
"LinePosition": 170,
"Path": "Root.Tree.Root.Actions.NotifyCustomerAction_Evacuate.Action",
"Value": "NotifyCustomerAction",
"SchemaId": "#/definitions/LeafNodeSummaryActionDefinition/properties/Action",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "enum",
"ChildErrors": []
},
{
"Message": "Property 'Properties' has not been defined and the schema does not allow additional properties.",
"LineNumber": 1,
"LinePosition": 184,
"Path": "Root.Tree.Root.Actions.NotifyCustomerAction_Evacuate.Properties",
"Value": "Properties",
"SchemaId": "#/definitions/LeafNodeSummaryActionDefinition",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "additionalProperties",
"ChildErrors": []
},
{
"Message": "JSON does not match schema from 'else'.",
"LineNumber": 1,
"LinePosition": 139,
"Path": "Root.Tree.Root.Actions.NotifyCustomerAction_Evacuate",
"Value": null,
"SchemaId": "#/definitions/ActionDefinition",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "else",
"ChildErrors": [
{
"Message": "Invalid type. Expected Object but got String.",
"LineNumber": 1,
"LinePosition": 230,
"Path": "Root.Tree.Root.Actions.NotifyCustomerAction_Evacuate.Properties",
"Value": "Notify customer in parallel with the impact.",
"SchemaId": "#/definitions/ActionDefinition/properties/Properties",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "type",
"ChildErrors": []
},
{
"Message": "Value \"NotifyCustomerAction\" is not defined in enum.",
"LineNumber": 1,
"LinePosition": 170,
"Path": "Root.Tree.Root.Actions.NotifyCustomerAction_Evacuate.Action",
"Value": "NotifyCustomerAction",
"SchemaId": "#/definitions/SubroutineActionDefinition/allOf/1/properties/Action",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "enum",
"ChildErrors": []
},
{
"Message": "Invalid type. Expected Object but got String.",
"LineNumber": 1,
"LinePosition": 230,
"Path": "Root.Tree.Root.Actions.NotifyCustomerAction_Evacuate.Properties",
"Value": "Notify customer in parallel with the impact.",
"SchemaId": "#/definitions/ActionDefinition/properties/Properties",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "type",
"ChildErrors": []
}
]
},
{
"Message": "Required properties are missing from object: Input.",
"LineNumber": 1,
"LinePosition": 139,
"Path": "Root.Tree.Root.Actions.NotifyCustomerAction_Evacuate",
"Value": [
"Input"
],
"SchemaId": "#/definitions/LeafNodeSummaryActionDefinition",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "required",
"ChildErrors": []
},
{
"Message": "JSON does not match all schemas from 'allOf'. Invalid schema indexes: 1.",
"LineNumber": 1,
"LinePosition": 52,
"Path": "Root.Tree.Root.Actions",
"Value": null,
"SchemaId": "#/definitions/ActionTypeNodeDefinition/properties/Actions",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "allOf",
"ChildErrors": [
{
"Message": "Invalid type. Expected Object but got String.",
"LineNumber": 1,
"LinePosition": 230,
"Path": "Root.Tree.Root.Actions.NotifyCustomerAction_Evacuate.Properties",
"Value": "Notify customer in parallel with the impact.",
"SchemaId": "#/definitions/ActionDefinition/properties/Properties",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "type",
"ChildErrors": []
}
]
},
{
"Message": "Object property count 2 exceeds maximum count of 1.",
"LineNumber": 1,
"LinePosition": 52,
"Path": "Root.Tree.Root.Actions",
"Value": 2,
"SchemaId": "#/definitions/LeafTypeNodeDefinition/properties/Actions",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "maxProperties",
"ChildErrors": []
},
{
"Message": "Required properties are missing from object: ChildSelector.",
"LineNumber": 1,
"LinePosition": 25,
"Path": "Root.Tree.Root",
"Value": [
"ChildSelector"
],
"SchemaId": "#/definitions/SelectionTypeNodeDefinition",
"SchemaBaseUri": "file://ForgeSchemaValidationRules.json",
"ErrorType": "required",
"ChildErrors": []
}
]
}
]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Forge.TreeWalker/contracts/ForgeSchemaValidationRules.json and reproduce the validator errors using the parallel-action schema in the issue. Check how the schema defines tree-node actions and subroutines; done means ForgeSchemaValidator accepts valid nodes containing parallel Action or Subroutine elements without rejecting the existing single-action form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100