Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.16 KB

identify.markdown

File metadata and controls

48 lines (36 loc) · 1.16 KB

Identify

jsonschema identify <schema.json> [--relative-to/-t <uri>] [--verbose/-v]

A schema may be associated with a URI through the use of keywords like $id or its predecessor id. This command takes a JSON Schema as input and prints to standard output the identifying URI of the schema. This command heuristically handles the case where you don't know the base dialect of the schema. For convenience, you may provide a base URI to resolve the schema identity URI against.

Examples

For example, consider the following schema identified as https://example.com/foo/bar.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/foo/bar"
}

We can interact with the identifier URI of this schema as follows:

$ jsonschema identify schema.json
https://example.com/foo/bar

$ jsonschema identify schema.json --relative-to "https://example.com"
/foo/bar

Identify a JSON Schema

jsonschema identify path/to/my/schema.json

Identify a JSON Schema resolving the URI relative to a given base

jsonschema identify path/to/my/schema.json --relative-to "https://example.com"