Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brittonhayes/validate-yaml
GitHub action for validating YAML against a schema
https://github.com/brittonhayes/validate-yaml
Last synced: 16 days ago
JSON representation
GitHub action for validating YAML against a schema
- Host: GitHub
- URL: https://github.com/brittonhayes/validate-yaml
- Owner: brittonhayes
- License: mit
- Created: 2021-10-01T04:58:10.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-02T00:01:37.000Z (over 1 year ago)
- Last Synced: 2024-10-15T13:35:40.014Z (25 days ago)
- Language: TypeScript
- Homepage:
- Size: 709 KB
- Stars: 7
- Watchers: 1
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# 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.
```yaml
- name: Validate YAML
uses: brittonhayes/validate-yaml
with:
schemaPath: 'schema.json'
files: |
example/foo.yaml
```### Example JSON Schema
```json
{
"test": {
"structure": {
"myValue": "string",
"myValue2": "string"
}
}
}
```### Example Valid YAML for this schema
```yaml
---
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```json
{
"structure": {
"school": {
"description?": "string",
"code": "number",
"principal": {
"name": "string"
},
"classRooms": [
{
"name": "string",
"id": "number",
"location?": {
"floor": "string",
"building": "string"
}
}
],
"teachers": ["string"]
}
}
}
```