Sycophant.Schema.Validator (sycophant v0.4.2)

Copy Markdown

Validates JSON-decoded data against a NormalizedSchema using ex_json_schema.

For Zoi-sourced schemas, string keys are coerced to atoms by walking the JSON Schema properties. Keys without a pre-existing atom are kept as strings. JSON Schema-sourced data is returned as-is with string keys.

Summary

Functions

Validates JSON-decoded data against a NormalizedSchema. Coerces keys to atoms for Zoi-sourced schemas.

Functions

validate(normalized_schema, data)

@spec validate(Sycophant.Schema.NormalizedSchema.t(), map()) ::
  {:ok, map()} | {:error, Splode.Error.t()}

Validates JSON-decoded data against a NormalizedSchema. Coerces keys to atoms for Zoi-sourced schemas.