Giter VIP home page Giter VIP logo

alombarte / jsonschema Goto Github PK

View Code? Open in Web Editor NEW

This project forked from intelligence-ai/jsonschema

0.0 0.0 0.0 2.96 MB

The CLI for working with JSON Schema. Covers formatting, linting, testing, and much more for both local development and CI/CD pipelines

License: GNU Affero General Public License v3.0

Shell 50.21% Ruby 0.03% C++ 39.74% Makefile 1.19% CMake 8.04% Dockerfile 0.78%

jsonschema's Introduction

JSON Schema

The command-line tool for working with JSON Schema, the world most popular schema language. It is a comprehensive solution for maintaining repositories of schemas and ensuring their quality, both during local development and when running on CI/CD pipelines. For example:

  • Ensure your schemas are valid
  • Unit test your schemas against valid and invalid instances
  • Enforce consistent indentation and keyword ordering in your schema files
  • Detect and fix common JSON Schema anti-patterns
  • Inline external references for conveniently distributing your schemas

Check out the documentation to learn more


Tip

Do you want to level up your JSON Schema skills? Check out learnjsonschema.com, our growing JSON Schema documentation website, and our O'Reilly book Unifying Business, Data, and Code: Designing Data Products with JSON Schema.


Warning

This project is under heavy development. Some features are partly available and may contain bugs. Please share feedback and give us a star show your support!

Current Limitations:

  • The validate and test commands only support JSON Schema Draft 4, Draft 6, and Draft 7
  • It is not possible to collect annotations with the validate command

What our users are saying

Amazing product. Very useful for formatting and bundling my schemas, plus it surfaced various referencing issues. 10 out of 10!

@alombarte, co-founder of the KrakenD API Gateway.

Installation

The JSON Schema CLI is written using C++ and CMake, and supports macOS, Windows, and GNU/Linux. Under the hood, it relies on the powerful JSON Toolkit library.

From Homebrew

brew install intelligence-ai/apps/jsonschema

From GitHub Actions

- uses: intelligence-ai/[email protected]

Where X.Y.Z is replaced with the desired version. For example:

- uses: intelligence-ai/[email protected]
# Then use as usual
- run: jsonschema fmt path/to/schemas --check

From NPM

npm install --global @intelligence-ai/jsonschema

From GitHub Releases

We publish precompiled binaries for every supported platforms to GitHub Releases, including a continuous that is updated on every commit from the main branch.

For convenience, we also provide a POSIX shell script capable of installing the latest pre-built binaries, which you can run as follows:

/bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/intelligence-ai/jsonschema/main/install -H "Cache-Control: no-cache, no-store, must-revalidate")"

From Dockerfile

You can compile the JSON Schema CLI inside a container and run it with Docker as follows:

docker build -t jsonschema .

Then, you run the JSON Schema CLI by mounting the desired directory as /workspace as follows:

docker run -it -v "$PWD:/workspace" jsonschema lint --verbose myschema.json

# You can optionally add this to your .alias (or similar) file:
# alias jsonschema="docker run -it -v \"$PWD:/workspace\" jsonschema"

Building from source

git clone https://github.com/intelligence-ai/jsonschema
cd jsonschema
cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build ./build --config Release --parallel 4
cmake --install ./build --prefix <prefix> \
  --config Release --verbose --component intelligence_jsonschema

Where <prefix> can be any destination prefix of your choosing, such as /opt or /usr/local.

Usage

The functionality provided by the JSON Schema CLI is divided into commands. The following pages describe each command in detail. Additionally, running the JSON Schema CLI without passing a command will print convenient reference documentation:

Coming Soon

This project is under heavy development, and we have a lot of cool things in the oven. In the mean-time, star the project to show your support!

Feature Description Status
Debugging Validate a JSON instance against a JSON Schema step by step, like LLDB and GDB Not started
Upgrading/Downgrading Convert a JSON Schema into a later or older dialect Not started

License

This project is governed by the AGPL-3.0 copyleft license.

jsonschema's People

Contributors

jviotti avatar alombarte avatar lpsinger 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.