JSPM

json-dereference-cli-v2

4.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q60124F

Provides a cli interface to the json-schema-ref-parser library

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (json-dereference-cli-v2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    JSON Dereference CLI v2

    Very simple CLI tool that wraps the excellent json-schema-ref-parser library.

    Node.js Package

    Usage

    # Using npx:
    npx json-dereference-cli-v2 -s <schema> [-i <spaces>] [-o <output>] [-t <type>]
    
    # Installing globally:
    npm install -g json-dereference-cli-v2
    json-dereference-v2 -s <schema> [-i <spaces>] [-o <output>] [-t <type>]

    Options

    • -s <schema>: Path to the input schema file (required).
    • -i <spaces>: Number of spaces for indentation in the output (default: 2).
    • -o <output>: Path to the output file (optional).
    • -t <type>: Output type (json or yaml). If not specified, it is inferred from the output file extension.

    Examples

    Dereference a JSON schema and output to a file:

    json-dereference-v2 -s testdata/correct.schema.json -o testdata/output.json

    Dereference a JSON schema and print to stdout in YAML format:

    json-dereference-v2 -s testdata/correct.schema.json -t yaml

    Note: The input file can either be json, or yaml / yml.

    Note: The output file types are either json or yaml / yml. This is determined from the file extension for the output file path passed in or using -t json|yaml when writing to stdout.

    Meta-Validation

    The CLI now supports validating JSON Schemas against their meta-schema to ensure correctness and adherence to best practices. This is automatically performed during dereferencing.

    Example:

    json-dereference-v2 -s testdata/correct.schema.json

    If the schema is invalid, an error message will be displayed.