Documentation
¶
Overview ¶
Package differ knowns how to Diff and Patch a pair of jsonschema.Schema s.
Diff ¶
Differences are qualified to detect breaking changes or backward-compatible changes.
Patch ¶
A jsonschema.Overlay is produced that when applied to the first jsonschema.Schema, yields the second one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteReport ¶
func WriteReport(w io.Writer, r Result, opts ...ReportOption) error
WriteReport knows how to render a diff Result as a human readable report.
Types ¶
type CategoryMode ¶
type CategoryMode uint8
CategoryMode qualifies the nature of a schema change, such as version of jsonchema, metadata only, validations only etc.
Several categories may apply to a single change.
const ( CategoryNone CategoryMode = 1 << iota CategoryVersion // JSON schema version CategoryMetadata CategoryLocation // change in $ref CategoryValidation CategoryDataType )
type ChangesOption ¶
type ChangesOption func(*changesOptions)
type Differ ¶
type Differ struct {
// contains filtered or unexported fields
}
Differ knows how to compare two versions of a json schema.
func (*Differ) Diff ¶
func (d *Differ) Diff(old, new jsonschema.Schema) Result
Diff computes the differences between new and old jsonschema.Schema as a diff Result.
func (*Differ) Patch ¶
func (d *Differ) Patch(old, new jsonschema.Schema) jsonschema.Overlay
Diff computes a jsonschema.Overlay patch that when applied to old, produces the new schema.
type ReportOption ¶
type ReportOption func(*reportOptions)
func WithThreshold ¶
func WithThreshold(minSeverity Severity) ReportOption
type ReportOutputMode ¶
type ReportOutputMode uint8
const ( ReportOutputTable ReportOutputMode = 1 << iota ReportOutputMarkdown ReportOutputHTML )
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result of the differences analysis between two schemas.
type Severity ¶
type Severity uint8
Severity qualifies the impact of a change, from cosmetic to breaking change.
type ValidationCategory ¶
type ValidationCategory uint8
ValidationCategory indicates more precisely the type of validation to which a change with ValidationCategory is eligible.
const ( NumberValidation ValidationCategory = iota StringValidation ObjectValidation ArrayValidation EnumValidation )