Lightning.Credentials.Schema (Lightning v2.16.8-pre)

View Source

Structure that can parse JsonSchemas (using ExJsonSchema) and validate changesets for a given schema.

Summary

Functions

Returns the original (unrecognized) JSON Schema type for a field if the schema's type was rewritten to "string" during loading, or nil otherwise.

Types

t()

@type t() :: %Lightning.Credentials.Schema{
  fields: [atom()],
  name: String.t() | nil,
  root: ExJsonSchema.Schema.Root.t(),
  types: Ecto.Changeset.types(),
  warnings: %{required(atom()) => String.t()}
}

Functions

new(body, name \\ nil)

@spec new(
  json_schema :: %{required(String.t()) => any()} | binary(),
  name :: String.t() | nil
) :: t()

properties(schema, field)

required?(schema, field)

validate(changeset, schema)

@spec validate(changeset :: Ecto.Changeset.t(), schema :: t()) :: Ecto.Changeset.t()

warning(schema, field)

@spec warning(t(), atom() | String.t()) :: String.t() | nil

Returns the original (unrecognized) JSON Schema type for a field if the schema's type was rewritten to "string" during loading, or nil otherwise.