schemacompat

package
v0.3.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureStructuralSchemaCompatibility

func EnsureStructuralSchemaCompatibility(fldPath *field.Path, existing, new *apiextensionsv1.JSONSchemaProps, narrowExisting bool) (*apiextensionsv1.JSONSchemaProps, error)

EnsureStructuralSchemaCompatibility compares a new structural schema to an existing one, to ensure that the existing schema is a sub-schema of the new schema. In other words that means that all the documents validated by the existing schema will also be validated by the new schema, so that the new schema can be considered backward-compatible with the existing schema. If it's not the case, errors are reported for each incompatible schema change.

PLEASE NOTE that the implementation is incomplete (it's ongoing work), but still consistent: if some Json Schema elements are changed and the comparison of this type of element is not yet implemented, then an incompatible change error is triggered explaining that the comparison on this element type is not supported. So there should never be any case when a schema is considered backward-compatible while in fact it is not.

If the narrowExisting argument is true, then the LCD (Lowest-Common-Denominator) between existing schema and the new schema is built (when possible), and returned if no incompatible change was detected (like type change, etc...). If the narrowExisting argument is false, the existing schema is untouched and no LCD schema is calculated.

In either case, when no errors are reported, it is ensured that either the existing schema or the calculated LCD is a sub-schema of the new schema.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL