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.