mpalmer / action-validator

Tool to validate GitHub Action and Workflow YAML files
GNU General Public License v3.0
277 stars 23 forks source link

incorrectly fails on.workflow_dispatch.inputs.*.options #20

Closed airtonix closed 1 year ago

airtonix commented 1 year ago
'on':
  workflow_dispatch:
    inputs:
      ApplicationName:
        description: 'Application name'
        required: true
        type: choice
        options: 
          - SomeName
          - SomeOtherName
          - YetMoarNames

results in :

✖ action-validator:
Validation failed: ValidationState {
    errors: [
        OneOf {
            path: "/on",
            states: [
                ValidationState {
                    errors: [
                        Enum {
                            path: "/on",
                        },
                        WrongType {
                            path: "/on",
                            detail: "The value must be string",
                        },
                    ],
                    missing: [],
                    replacement: None,
                },
                ValidationState {
                    errors: [
                        WrongType {
                            path: "/on",
                            detail: "The value must be array",
                        },
                    ],
                    missing: [],
                    replacement: None,
                },
                ValidationState {
                    errors: [
                        Properties {
                            path: "/on/workflow_dispatch/inputs/ApplicationName",
                            detail: "Additional property 'options' is not allowed",
                        },
                        Properties {
                            path: "/on/workflow_dispatch/inputs/ApplicationName",
                            detail: "Additional property 'type' is not allowed",
                        },
                    ],
                    missing: [],
                    replacement: None,
                },
            ],
        },
    ],
    missing: [],
    replacement: None,
}
mpalmer commented 1 year ago

Howdy. Thanks for reporting this. I've bumped the source JSON schemas and the example you provided (thanks for that, makes life a lot easier for me) now appears to pass. If the next release of action-validator still doesn't work for your actual workflows, please feel free to adjust test/006_workflow_dispatch_inputs_options/test.yml to show what's failing, and I'll take a look.