Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »


0.0.7 • Public • Published


SchemaType Compiler, Validator, Translator, Formatter and Generator


# Check if a YAML file is well-formed:
> stp validate -s file-schema.stp file.yaml


The schematype package installs a CLI program called stp. The stp tool has many functions related to SchemaType. It can do data document (YAML, JSON, others) validation. It can import other kinds of schema into SchemaType and it can export SchemaType back into those formats. It can compile and reformat SchemaType (.stp) files. Most importantly, it can generate all kinds of software code from SchemaType files. These include:

  • Input editors
  • Client struct/typedef code
  • Server model code
  • Database SQL
  • Data visualizers
  • Test input
  • Documentation


The stp command is currently written in Node.js. To install it, run:

> npm install -g schematype
> stp -h

You can also easily run it as with Docker, if you have Docker installed and don't want to install it with Node.js/npm. See below.


The stp command has many functions. It has a subcommand for each function. The general usage is:

stp <command> [<option>...] [<file>...]

Use this to get a help overview:

stp -h

this to see the full help:

stp help

and this to get help for a specific command:

stp help <command>

See below for a full description of each command and option.

Running with Docker

If you use Docker, you don't need to install schematype, stp or Node.js at all. Just create a shell alias:

alias stp='docker run --rm -it -v $PWD:/data schematype/stp'

then you can use the stp alias just like an installed version of stp.


These commands are currently supported:

  • compile -- Compile a .stp file to a .stpx file.
  • export -- Export a .stp file to a .jsc (JSON Schema) file.
  • validate -- Validate one or more data documents against a schema.

These commands will be implemented soon:

  • convert -- Convert a data file from one format to another
  • create -- Create a .stp file from valid data files
  • format -- Reformat a .stp file to a desired style
  • generate -- Generate code from a schema file
  • import -- Import .stp from other formats


The --quiet and --verbose options are available for all commands. The --schema option is used for all commands that need a schema. The --input and --output options specify files explicitly when they can't be inferred from a file list. The --from and --to options specify the input and output formats when they can't be inferred from file extensions or content heuristics.

Many commands accept a list of file paths to perform the specified operation on. Input files can either be local paths or they can be URLs. You can also use the --input option to specify one input explicitly. The --input option should not be used along with a file list. Use one or the other.

The stp command has the following options:

  • -q, --quiet Tell stp to be less noisy about what it is doing.
  • -v, --verbose Tell stp to be more moisy about what it is doing.
  • -s, --schema=<file> Specify the schema to use for this operation. Schema files end with .stp and compiled schema files end with .stpx. If the schema path is specified without a file extension, stp will look for a .stpx file, and then for a .stp file. If the path is a directory (URLs should end with /), stp will look for index.stpx or index.stp file.
  • -i, --input=<file> Specify a single input file path (or URL) for the operation. Use this in place of the file list argument if appropriate. A value of - indicates that the input will be read from STDIN. The file extension will be used as the --from value, if that is needed.
  • -o, --output=<file> Specify a single output file path for the operation. A value of - indicates that the output will be written to STDOUT. The file extension will br used as the --to value, if needed.
  • -f, --from=<format> SchemaType commands can operate on different types of input data (like YAML or JSON) for example. The --from option explicitly specifies the input format. Usually stp can correctly guess the input format. Use this option when it can't.
  • -t, --to=<format> Explicitly specify the output format for the command.
  • -l, --layout=<layout> When stp writes output files, there is often more than one way to do it. This option specifies the output layout style to use. Current styles are:
    • compact Write .stp files in a more compact form. Write JSON files without whitespace between tokens. The JSON default is a pretty style.
    • explicit Write .stp files in a more explicit style. The default is a medium between compact and explicit.


You can try out stp yourself with these commands:

> git clone https://github.com/schematype/schematype-js
> cd schematype-js/test/manifest
> stp validate -s manifest.stp manifest.yml
> stp compile -i manifest.stp
> stp export -i manifest.stp -t jsc

Or you can skip the git clone and do it using URLs for the file names:

> stp validate -s \
      https://raw.githubusercontent.com/schematype/schematype-js/master/test/manifest/manifest.stp \

See Also

  • "JSON Schema"<...>


npm i schematype

Downloadsweekly downloads








last publish


  • avatar
Report a vulnerability