Giter VIP home page Giter VIP logo

schema-validator-action's Introduction

JSON Schema Validator

Go Report Card FOSSA Status

This is a utility (and Github action) that recursively walks a directory and validates all JSON files that it finds. Based on this great validation library

Usage

The schema-validator looks for the following environment variables to control it's behavior:

  • GITHUB_WORKSPACE the directory to walk, all subdirectories are also inspected. When run as an action github will populate this value with the root of the repository
  • FORCE_SCHEMA_LOCATION (optional) the location of a schema to use for validation(can be file path or http/s)
  • FAIL_FAST (default false) if set the tool will exit on first error
  • REQUIRE_SCHEMAS (default false) setting this will cause JSON files without declared schemas to be considered validation failures

Examples

Make sure every JSON file on your machine is GeoJSON, fail if one isn't:

$ env FAIL_FAST=true REQUIRE_SCHEMAS=https://json.schemastore.org/geojson.json GITHUB_WORKSPACE=/ schema-validator

Inside a GitHub workflow yaml file:

steps:
   - uses: actions/checkout@v2
   - uses: earthrise-media/schema-validator-action@main

Behavior

Files are validated only if they end in .json or .geojson Validation includes:

  1. Must be valid JSON syntax (i.e. braces and quotes must be closed etc.)
  2. Schema validation:
    • If a schema is provided to the tool (using the FORCE_SCHEMA_LOCATION env var) it will override any schema declared in the JSON file
    • If no schema is provided the file will be validated using any schema declared in a top level $schema field
    • If no schema is found in the file, it will be considered valid unless the REQUIRE_SCHEMAS env var is set, in which case it will be considered a failure

License

FOSSA Status

schema-validator-action's People

Contributors

fossabot avatar tingold avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.