Exdantic.FieldMeta (exdantic v0.0.2)

View Source

Struct for field metadata in Exdantic schemas.

This module defines the structure and types for field metadata used throughout the Exdantic schema system.

Summary

Functions

Creates a new FieldMeta struct with the given parameters.

Types

t()

@type t() :: %Exdantic.FieldMeta{
  constraints: [term()] | nil,
  default: term() | nil,
  description: String.t() | nil,
  example: term() | nil,
  examples: [term()] | nil,
  extra: %{required(String.t()) => term()},
  name: atom(),
  optional: boolean() | nil,
  required: boolean(),
  type: Exdantic.Types.type_definition()
}

Functions

new(name, type, required)

@spec new(atom(), Exdantic.Types.type_definition(), boolean()) :: t()

Creates a new FieldMeta struct with the given parameters.

Parameters

  • name - The field name (atom)
  • type - The field type definition
  • required - Whether the field is required (boolean)

Examples

iex> Exdantic.FieldMeta.new(:email, {:type, :string, []}, true)
%Exdantic.FieldMeta{name: :email, type: {:type, :string, []}, required: true}