Categorygithub.com/santhosh-tekuri/jsonschema/v6
modulepackage
6.0.1
Repository: https://github.com/santhosh-tekuri/jsonschema.git
Documentation: pkg.go.dev

# README

jsonschema v6.0.0

License GoDoc Go Report Card Build Status codecov

see godoc for examples

Library Features

  • pass JSON-Schema-Test-Suite excluding optional(compare with other impls at bowtie)
    • draft-04
    • draft-06
    • draft-07
    • draft/2019-09
    • draft/2020-12
  • detect infinite loop traps
    • $schema cycle
    • validation cycle
  • custom $schema url
  • vocabulary based validation
  • custom regex engine
  • format assertions
    • flag to enable in draft >= 2019-09
    • custom format registration
    • built-in formats
      • regex, uuid
      • ipv4, ipv6
      • hostname, email
      • date, time, date-time, duration
      • json-pointer, relative-json-pointer
      • uri, uri-reference, uri-template
      • iri, iri-reference
      • period, semver
  • content assertions
    • flag to enable in draft >= 7
    • contentEncoding
      • base64
      • custom
    • contentMediaType
      • application/json
      • custom
    • contentSchema
  • errors
    • introspectable
    • hierarchy
      • alternative display with #
    • output
      • flag
      • basic
      • detailed
  • custom vocabulary
    • enable via $vocabulary for draft >=2019-19
    • enable via flag for draft <= 7
  • mixed dialect support

CLI

to install: go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest

Usage: jv [OPTIONS] SCHEMA [INSTANCE...]

Options:
  -c, --assert-content    Enable content assertions with draft >= 7
  -f, --assert-format     Enable format assertions with draft >= 2019
      --cacert pem-file   Use the specified pem-file to verify the peer. The file may contain multiple CA certificates
  -d, --draft version     Draft version used when '$schema' is missing. Valid values 4, 6, 7, 2019, 2020 (default 2020)
  -h, --help              Print help information
  -k, --insecure          Use insecure TLS connection
  -o, --output format     Output format. Valid values simple, alt, flag, basic, detailed (default "simple")
  -q, --quiet             Do not print errors
  -v, --version           Print build information
  • exit code 1 for validation erros, 2 for usage errors
  • validate both schema and multiple instances
  • support both json and yaml files
  • support standard input, use -
  • quite mode with parsable output
  • http(s) url support
    • custom certs for validation, use --cacert
    • flag to skip certificate verification, use --insecure

# Packages

No description provided by the author

# Functions

LocalizableError is an error whose message is localizable.
NewCompiler create Compiler Object.
UnmarshalJSON unmarshals into [any] without losing number precision using [json.Number].

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
Compiler compiles json schema into *Schema.
CompilerContext provides helpers for compiling a [Vocabulary].
Decoder specifies how to decode specific contentEncoding.
A Draft represents json-schema specification.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
FileLoader loads json file url.
Flag is output format with simple boolean property valid.
Format defined specific format.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
MediaType specified how to validate bytes against specific contentMediaType.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Schema is the regpresentation of a compiled jsonschema.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ValidatorContext provides helpers for validating with [SchemaExt].
Vocabulary defines a set of keywords, their syntax and their semantics.

# Interfaces

No description provided by the author
Position tells possible tokens in json.
Regexp is the representation of compiled regular expression.
SchemaExt is compled form of vocabulary.
URLLoader knows how to load json from given url.

# Type aliases

No description provided by the author
No description provided by the author
RegexpEngine parses a regular expression and returns, if successful, a Regexp object that can be used to match against text.
SchemaPath tells where to look for subschema inside keyword.
SchemeURLLoader delegates to other [URLLoaders] based on url scheme.
Types encapsulates list of json value types.