Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

schema-watcher

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

schema-watcher

File Watcher + Schema Validator

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

schema-watcher (swatch)

A bare-bones command line utility that watches a JSON-schema file and a data file and validates the data against the schema in real time

swatch demo

Installation

npm i -g schema-watcher

or

yarn global add schema-watcher

Usage

> swatch [-h] -f FILE -s SCHEMA [-q QUERY] [-d]
  • --help (-h): Show the help message

  • --file (-f) FILE: Path to the data file (YAML or JSON)

  • --schema (-s) SCHEMA: Path to a schema file (YAML or JSON)

  • --query (-q) QUERY: JMESpath query to the schema if nested within a larger document. Particularly useful when validating against a nested portion of a larger schema.

    For example, if you have a file with multiple schemas like this

    schema-1:
     type: object
     properties: 
        something:
            $ref: '#./schema-2'
         
    schema-2:
     type: object
     properties: 
        hello:
            type: string
            enum:
                - world
                - nurse
                - dolly
    

    you could validate a document against schema-2 by specifying --query schema-2

  • -d: Dereference the Schema object (i.e. expand the '$ref' attributes). This may be required when the schema is nested within a larger document, but may increase memory usage and slow down validation. In the above example, when validing a docuemnt against schema-1 you may need to specify the -d flag to dereference the $ref: ... reference

Keywords

FAQs

Package last updated on 10 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc