Aurora.Uix.Parsers.Common (Aurora UIX v0.1.4-rc.1)

Copy Markdown

Provides default value resolution for schema-derived properties in Aurora.Uix parsers.

Implements the Aurora.Uix.Parser behaviour to resolve default values from Ecto schema modules. Supports extracting metadata such as module names, titles, sources, and primary keys directly from schema definitions.

Supported Properties

  • :module - Underscored module name (e.g., "blog_post" from MyApp.BlogPost)
  • :module_name - Last part of module name (e.g., "BlogPost" from MyApp.BlogPost)
  • :name - Capitalized module name (e.g., "Blog Post" from MyApp.BlogPost)
  • :source - Schema table name from __schema__(:source)
  • :source_key - Safe atom conversion of source
  • :title - Capitalized schema source name
  • :primary_key - Primary key fields from __schema__(:primary_key)

Summary

Functions

Returns the list of supported option keys for schema metadata extraction.

Resolves the default value for a given schema-derived property.

Functions

get_options()

@spec get_options() :: [atom()]

Returns the list of supported option keys for schema metadata extraction.

Returns

list(atom()) - List of supported option keys.

option_value(parsed_opts, map, opts, atom)

@spec option_value(map(), map(), keyword(), atom()) :: term()

Resolves the default value for a given schema-derived property.

Uses the Ecto schema module to extract metadata. Requires :schema key in resource_config containing a valid Ecto schema module.

Parameters

  • parsed_opts (map()) - Accumulator for parsed options.
  • resource_config (map()) - Contains :schema (module()) - the Ecto schema module.
  • key (atom()) - The property key to resolve.

Returns

term() - The resolved default value for the property.