Skip to content

jslacks/tools-json-systems

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Welcome to JSON Systems

JSON Systems

JSON Systems provide 3 ways to generate JSON Schema from JSON

  1. Web application
  2. Application Programming Interface (API)
  3. Command Line Interface (CLI)

Web App

JsonSchema.net is a modern web application for generating JSON Schema from JSON. JSON Schema is generated according to the JSON Schema Validation: A Vocabulary for Structural Validation of JSON. A number of features make generating schemas quick and easy

  • Inbuilt JSON Schema editor with keyword search
  • Syntax highlighting, formatting, and code folding
  • Highly customisable settings to control how schemas are generated
  • JSON Schema keyword autocompletion (according to the specification)

If you've found a bug or have a feature request, please open a new issue.

API

The same API that powers JsonSchema.Net is available to developers to automate JSON schema generation The API is available as both a REST API and gRPC API. If you would like to know more please email [email protected].

CLI

The jsn application is a modern CLI for generating JSON Schema from JSON and is available for Mac OS, Windows, and Linux. If you would like to know more please email [email protected]. Below is the command-line help output of the JSON Schema CLI and should give you a feel for its functionality.

The jsn generate-schema command.

To get started you need only provide the path to your JSON document.

Example:

        $ jsn generate-schema example.json

To control which keywords appear in the JSON Schema, use the --keywords flag.

Example:

        $ jsn generate-schema example.json --keywords="additionalItems,additionalProperties,type"

If specified in the --keywords flag, the value of individual keywords can be controlled using keyword specific flags.

Example:

        $ jsn generate-schema example.json --keywords="properties,additionalProperties" --additional-properties=false

As an alternative to parameters, a configuration file can be used to control the resulting schema.

Example:

        $ jsn generate-schema example.json --config=config.yaml

The configuration file can be overwritten using command line flags.

Example:

        $ jsn generate-schema example.json --config=config.yaml --no-pretty=false

Usage:
  jsn generate-schema JSON_FILE [flags]

Examples:
  jsn generate-schema example.json 
  jsn generate-schema example.json --no-pretty=false
  jsn generate-schema example.json --keywords="additionalItems,additionalProperties,type"
  jsn generate-schema example.json --config=config.yaml
  jsn generate-schema example.json --config=config.yaml --no-pretty=true

Flags:
      --additional-items        The "additionalItems" keyword value (default true)
      --additional-properties   The "additionalProperties" keyword value (default true)
      --array-rule string       The rule to use for the "items" keyword (default "type"). Can be one of "empty", "first", "tuple" or "type"
                                 - "empty", use empty schema "{}"
                                 - "first", use the first element only to generate
                                 - "tuple", use all elements in the array
                                 - "type", generate a schema for each type
                                  
      --base-uri string         Defines a URI for the schema and the value of the "$id" keyword (default "https://example.com/root.json")
  -c, --config string           Config file path
      --examples-rule string    The rule to use for generation of "examples" keyword (default "full"). Can be one of "primitive", "compound" or "full"
                                 - "primitive", only generate examples for string, number, boolean, null 
                                 - "compound", only generate examples for objects and arrays
                                 - "full", generate examples for all types
                                 
  -h, --help                    help for generate-schema
      --js-types-only           Use "number" for all numeric types in "type" key
      --keywords strings        A comma separated list of keywords to be generated. Must not contain spaces. Available values
                                 - "additionalItems"
                                 - "additionalProperties"
                                 - "default"
                                 - "description"
                                 - "examples"
                                 - "id"
                                 - "items"
                                 - "minimum"
                                 - "properties"
                                 - "required"
                                 - "schema"
                                 - "title"
                                 - "type"
                                 - "uniqueItems"
                                
                                Consider using the "config" flag to manage keywords (default [schema,id,type,properties,items])
  -p, --no-pretty               Do not pretty print the output
      --specification string    The JSON Schema specification to use (default "201909"). Can be one of "draft04", "draft06", "draft07" or "201909"
                                 - "draft04" use the Draft 4 JSON Schema specification
                                 - "draft06" use the Draft 6 JSON Schema specification
                                 - "draft07" use the Draft 7 JSON Schema specification
                                 - "201909" use the Draft 2019-09 JSON Schema specification
                                 
      --unique-items            The "uniqueItems" keyword value (default false)

Global Flags:
  -f, --logs-format string   Specify logs format: "plain" or "json" (default "plain")
  -x, --trace                Trace output (very noisy logs up to trace level) not usable in normal situations
  -v, --verbose              Verbose output (up to debug level)

What is the goal?

JSON Schema is great, but can be verbose. For example, a single empty JSON object, {}, can be described by:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "additionalProperties": true,
  "definitions": {},
  "id": "http://example.com/example.json",
  "properties": {
    "description": "This accepts anything, as long as it's valid JSON.",
    "title": "Empty Object"
  },
  "type": [
    "object",
    "null"
  ]
}

Even schemas for small APIs can quickly become hundreds of lines long. Writing schemas by hand is tedious and time consuming, and often impractical. JSON Systems makes schema generation quick and painless. Depending on your use-case, you can choose from either the web app, CLI, or API.

Who uses this software?

Anyone wishing to generate JSON schema from JSON. Typical users are web developers and mobile app developers. Some educational institutions also use JsonSchema.Net to teach JSON Schema and the core options defined by JSON Schema Validation.

How can your organization benefit?

The web app, CLI, and API, can save you and anyone on your team a lot of time. If your software uses JSON, it's good practice to validate any (JSON) data it receives, against a schema. A CLI and API are aimed for teams wishing to integrate JSON Schema with their software or processes.

Specifications

JSON Schema specificaiton is split into three parts

  1. Core - The basic foundation of JSON Schema.
  2. Validation - The validation keywords of JSON Schema.
  3. Hyper-Schema - The hyper-media keywords of JSON Schema.

JsonSchema.net follows the Validation part of the overall specification. However, the extent to which this is true changes between specifications as keywords move between Core, Validation, and Hyper-Schema. json-schema.org/specification.html is a good place to learn more.

Versioning of JSON Schema specifications can be confusing. json-schema.org maintains a helpful list of specification-links. In reverse chronological order:

  • Draft 2020-12
  • Draft 2019-09
  • Draft 7
  • Draft 6
  • Draft 5
  • Draft 4
  • Draft 3
  • Drafts 0/1/2

Each version updates (to varying degrees) the three parts of JSON Schema specification: Core, Validation, and Hyper-Schema.

FAQs

Web app

JsonSchema.net looks different. What changed?

In January 2022, a new version of the JSON Schema web app was launched. This new version was a complete rewrite of the web app and brought with it many new features and bug fixes.

Will my login still work?

No, accounts and account details were not migrated to the new version.

Where did my old schemas go?

JsonSchema.net recently underwent a complete rewrite, in the process it was announced that previously generated schemas will not be migrated to the new web app.

I've found a bug

Please open a new issue github.com/jsonsystems/public/issues.

I have a feature request

Great. Please open a new issue github.com/jsonsystems/public/issues.

Is there feature parity with the previous app?

While there are many improvements, not all features have been ported to the new app, namely

  • Email schema functionality
  • XML view
  • YAML view

CLI

Where can I download the CLI?

A trial version of the CLI is available to download. This version can be used indefinitely but limits the user's JSON document to not more than 250 bytes.

Where can I find out more about the CLI?

Please contact [email protected].

Is a library available?

A library has not been published. If you're interested in using our Go library in your application pleaase contact help@jsonschemanet.

API

Where can I find out more about the API?

Please contact [email protected].

What type of API is it?

The Json Schema API is available as both a REST and gRPC. In both cases the API is resource oriented.

Contact

Email: [email protected]

Cookie Policy

Our cookie policy can be read at cookies.md

Privacy Policy

Our privacy policy can be read at privacy.md

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published