Conform.Schema
This module is responsible for the handling of schema files.
Summary↑
coalesce() | Load the schemas for all dependencies of the current project, and merge them into a single schema. Schemas are returned in their quoted form |
coalesce(schemas) | Given a collection of schemas, merge them into a single schema |
empty() | |
from_config(config) | Convert standard configuration to quoted schema format |
load!(path) | Load a schema either by name or from the provided path. Used for schema evaluation only |
load(path) | Loads a schema either by name or from the provided path. If there is a problem parsing the schema, or it doesn’t exist, an empty default schema is returned. Used for schema evaluation only |
merge(x, y) | Merges two schemas. Conflicts are resolved by taking the value from |
read!(path) | Reads a schema file as quoted terms. This is used for manipulating the schema (such as merging, etc.) |
schema_filename(app) | get the current app’s schema filename |
schema_path() | Get the current app’s schema path |
schema_path(app) | |
stringify(schema) | Converts a schema to a prettified string. Expects the schema to be in it’s quoted form |
write(schema, path) | Saves a schema to the provided path |
write_quoted(schema, path) | Converts a schema in it’s quoted form and writes it to the provided path |
Types ↑
schema :: [import: [atom], mappings: [mapping], translations: [translation]]
mapping :: {atom, [doc: binary, to: binary, datatype: atom, default: term]}
translation :: {atom, (... -> any)}
Functions
Specs:
- coalesce :: schema
Load the schemas for all dependencies of the current project, and merge them into a single schema. Schemas are returned in their quoted form.
Specs:
Given a collection of schemas, merge them into a single schema
Specs:
- from_config([] | [{atom, term}]) :: [{atom, term}]
Convert standard configuration to quoted schema format
Specs:
- load(binary | atom) :: schema
Loads a schema either by name or from the provided path. If there is a problem parsing the schema, or it doesn’t exist, an empty default schema is returned. Used for schema evaluation only.
Specs:
- load!(binary | atom) :: schema
Load a schema either by name or from the provided path. Used for schema evaluation only.
Specs:
Merges two schemas. Conflicts are resolved by taking the value from y
.
Expects the schema to be provided in it’s quoted form.
Specs:
- read!(binary | atom) :: schema
Reads a schema file as quoted terms. This is used for manipulating the schema (such as merging, etc.)
get the current app’s schema filename
Specs:
- schema_path :: binary
Get the current app’s schema path
Specs:
- stringify([term]) :: binary
Converts a schema to a prettified string. Expects the schema to be in it’s quoted form.
Specs:
- write(schema, binary) :: :ok | {:error, term}
Saves a schema to the provided path
Specs:
- write_quoted(schema, binary) :: :ok | {:error, term}
Converts a schema in it’s quoted form and writes it to the provided path