Backplane.Schema.JSONSchema.Decoder (backplane_schema v1.10.60)

Copy Markdown

Decodes a JSON Schema (Draft 7) map into a Backplane.Schema schema definition.

Returns {:ok, schema} on success or {:error, errors} if the resulting Backplane.Schema schema fails Backplane.Schema.validate_schema/1.

Recursive local references and allOf intersections that Backplane.Schema cannot represent return {:error, reason} instead of being expanded or merged into a schema with different validation semantics. oneOf is represented as Backplane.Schema's first-success union and therefore behaves like anyOf.

Prefer Backplane.Schema.from_json_schema/1 as the public entry point.

Summary

Functions

decode(json_schema, opts)

@spec decode(map(), [opt]) :: {:ok, Backplane.Schema.schema()} | {:error, term()}
when opt: {:keys, :strings | :atoms | :atoms!}