Giter Site home page Giter Site logo

qontract-validator's Introduction

qontract-validator

This project contains the tools necessary to bundle data into the format used by qontract-server and to JSON validate it's schema.

Create a bundle: qontract-bundler

Overview

A bundle is a JSON document containing the payload that will be served by qontract-server. It is has four top level keys:

  • data: documents that will be JSON validated
  • resources: documents that will not be JSON validated.
  • schemas: JSON validation schemas (json-schema.org)
  • graphl: The GraphQL schema in intermediary format (this will not be needed eventually).

Example:

{
  "data": {
    "/path/to/validated/doc1.yml": {
      "path": "/path/to/validated/doc1.yml",
      "$schema": "/schema1.yml",
      "key1": "...",
      "key2": "...",
      ...
    },
    ...
  },
  "resources": {
    "/path/to/NOT/validated/doc1": {
      "path": "/path/to/NOT/validated/doc1",
      "content": "...",
      "sha256sum": "..."
    },
    ...
  },
  "schemas": {
    "/schema1.yml": {
      "$schema": "...",
      "...": "...",
    }
  },
  "graphql": {
    {
      "name": "...",
      "fields": [
        {
          "isRequired": true,
          "type": "string",
          "name": "...""
        },
      ],
    },
  }
}

Usage

Usage: qontract-bundler [OPTIONS] SCHEMA_DIR GRAPHQL_SCHEMA_FILE DATA_DIR
                        RESOURCE_DIR


Options:
  --resolve  Resolve references
  --help     Show this message and exit.

Docker Usage

Container: https://quay.io/repository/app-sre/qontract-validator

Example:

docker run -v <mounts> \
    quay.io/app-sre/qontract-validator:latest \
    qontract-bundler /schemas /graphql-schema/schema.yml /data /resources

Validating the bundle: qontract-validator

Overview

This command validates the data key in the bundle (DATA_DIR) against the json schemas in the schemas key (SCHEMA_DIR).

It will exit 0 upon success and 1 otherwise.

Usage

Usage: qontract-validator [OPTIONS] BUNDLE

Options:
  --only-errors  Print only errors
  --help         Show this message and exit.

Docker usage

Container: https://quay.io/repository/app-sre/qontract-validator

Example:

docker run -v $PWD:/data:z \
    quay.io/app-sre/qontract-validator:latest \
    qontract-validator --only-errors /data/data.json

Licence

Apache License Version 2.0.

Authors

These tools have been written by the Red Hat App-SRE Team.

qontract-validator's People

Contributors

jmelis avatar jfchevrette avatar geoberle avatar maorfr avatar rporres avatar bhushanthakur93 avatar bsquizz avatar janboll avatar lechuk47 avatar kwilczynski avatar piojo avatar apahim avatar

Watchers

James Cloos avatar  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.