Skip to content

ForgeSchemaValidator Fails in Validating Schemas with Parallel Action or Subroutine elements  #58

@nibalach

Description

@nibalach

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": []
            }
        ]
    }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions