Skip to content

0.14.0 - schema_ref swaps precedence

Latest
Compare
Choose a tag to compare
@radix radix released this 05 Nov 05:52

schema_ref swaps precedence

This is another technically backwards-incompatible change, though it's very likely to be noticeable:

  • schema_ref now lets the "local" schema take precedence over the schema being referenced. This way, if a shared schema that you are specifying with schema_ref defines a field foo, and your schema also defines a field foo, the version of the field from your local schema will take precedence.

As an example, here's a registry with my_common_schema

registry:
  my_common_schema:
    type: dict
    fields:
      foo: {type: string}

Now, if somewhere we have a snippet like so:

schema_ref: my_common_schema:
fields:
  foo: {type: integer}

Then a foo field will be validated as an integer instead of a string. In previous versions, the foo from my_common_schema would be used instead.

debug

There is now a debug directive that prints out the schema and value when the schema is being applied to a value. Specify a message to include in the debug output, so you know which debug output belongs to which schema.

type: dict
debug: "This is my dict!"