GitHub action for validating YAML against a schema
Find a file
dependabot[bot] a310a8d228
build(deps-dev): Bump @typescript-eslint/parser from 5.8.1 to 5.54.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.8.1 to 5.54.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.54.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-01 23:59:55 +00:00
.github fix: removing automerge github action 2022-01-01 16:55:22 -08:00
dist chore: Repository cleanup and re-structure 2021-12-24 14:13:55 -08:00
src chore: Repository cleanup and re-structure 2021-12-24 14:13:55 -08:00
.eslintignore chore: Repository cleanup and re-structure 2021-12-24 14:13:55 -08:00
.eslintrc.json fix: migrating to yaml validation action 2021-10-01 00:17:49 -07:00
.gitattributes fix: migrating to yaml validation action 2021-10-01 00:17:49 -07:00
.gitignore chore: Repository cleanup and re-structure 2021-12-24 14:13:55 -08:00
.prettierignore Initial commit 2021-09-30 21:58:11 -07:00
.prettierrc.json Initial commit 2021-09-30 21:58:11 -07:00
action.yml fix: adding branding to action.yml 2021-10-01 00:30:23 -07:00
CODEOWNERS chore: Add dependabot permissions for dep management and set frequency to monthly 2022-01-01 16:31:28 -08:00
jest.config.js Initial commit 2021-09-30 21:58:11 -07:00
LICENSE Initial commit 2021-09-30 21:58:11 -07:00
package.json build(deps-dev): Bump @typescript-eslint/parser from 5.8.1 to 5.54.0 2023-03-01 23:59:55 +00:00
README.md fix: more detailed readme 2021-10-01 00:42:24 -07:00
tsconfig.json chore: Repository cleanup and re-structure 2021-12-24 14:13:55 -08:00
yarn.lock build(deps-dev): Bump @typescript-eslint/parser from 5.8.1 to 5.54.0 2023-03-01 23:59:55 +00:00

Validate YAML

Github action to validate yaml files against a JSON schema

Usage

Validate your YAML files against a JSON structure by providing a schema path and a list of files.

- name: Validate YAML
  uses: brittonhayes/validate-yaml
  with:
    schemaPath: 'schema.json'
    files: |
      example/foo.yaml      

Example JSON Schema

{
  "test": {
    "structure": {
      "myValue": "string",
      "myValue2": "string"
    }
  }
}

Example Valid YAML for this schema

---
test:
  structure:
    myValue: '1'
    myValue2: '2'

More Complex Schema

  • Use ? to indicate an optional field
  • Specify the preferred type with values like "string" or "number"
  • Replicate deeply nested structures in JSON to represent expected YAML
{
  "structure": {
    "school": {
      "description?": "string",
      "code": "number",
      "principal": {
        "name": "string"
      },
      "classRooms": [
        {
          "name": "string",
          "id": "number",
          "location?": {
            "floor": "string",
            "building": "string"
          }
        }
      ],
      "teachers": ["string"]
    }
  }
}