mirror of
https://github.com/brittonhayes/validate-yaml.git
synced 2024-11-23 05:30:56 -05:00
GitHub action for validating YAML against a schema
dd260dd405
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.8.0 to 5.8.1. - [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.8.1/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.github | ||
dist | ||
src | ||
.eslintignore | ||
.eslintrc.json | ||
.gitattributes | ||
.gitignore | ||
.prettierignore | ||
.prettierrc.json | ||
action.yml | ||
CODEOWNERS | ||
jest.config.js | ||
LICENSE | ||
package.json | ||
README.md | ||
tsconfig.json | ||
yarn.lock |
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"]
}
}
}