Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/OrRosenblatt/validate-json-action
A Github action for validating JSON.
https://github.com/OrRosenblatt/validate-json-action
Last synced: 3 months ago
JSON representation
A Github action for validating JSON.
- Host: GitHub
- URL: https://github.com/OrRosenblatt/validate-json-action
- Owner: OrRosenblatt
- License: mit
- Created: 2019-11-11T09:19:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T00:45:58.000Z (about 2 years ago)
- Last Synced: 2024-10-31T10:48:50.743Z (3 months ago)
- Language: TypeScript
- Size: 271 KB
- Stars: 79
- Watchers: 5
- Forks: 19
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Github Action: Validate JSON
A GitHub Action that validates JSON files based on a JSON Schema.This project uses [`ajv`](https://github.com/epoberezkin/ajv), fast JSON schema validator, to perform the validation.
## Usage
### Inputs
- `schema`: Relative file path under the repository of a JSON schema file to validate the other JSON files with. Default is: `'./schema.json'`.
- `jsons`: One or more relative file paths under the repository (seperated by comma) of the JSON files to validate with the schema provided.> Note: `schema` is **required**, otherwise default will be used.
### Outputs
- `invalid`: One or more of relative file paths of the invalid JSON files, found in the repository (seperated by comma).
### Example Workflow
An example `.github/workflows/validate.yml` workflow to run JSON validation on the repository:
```yaml
name: Validate JSONson: [pull_request]
jobs:
verify-json-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Validate JSON
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: /path/to/schema.json
INPUT_JSONS: /path/to/file.json,/path/to/another/file.json
```## TODOs
- [x] Initial validation action
- [x] Docker
- [ ] Automate release process
- [ ] Github workflow screenshots
- [ ] Support `exclude` & `include` in PRs (JSONs from pattern)
- [ ] Support `schema` & `jsons` by external reference (from S3/GitHub/etc...)
- [ ] Support `delimiter` input