ExScim.Schema.Builder.Helpers (ex_scim v0.2.2)

Copy Markdown View Source

Pure functions for building SCIM schema maps.

These helpers convert DSL attribute definitions into RFC 7643-compliant schema map structures.

Summary

Functions

Builds an attribute map from DSL options.

Builds the complete schema map from DSL-collected data.

Builds a sub-attribute map (used inside complex attributes).

Functions

build_attribute(name, type, opts, sub_attributes \\ nil)

@spec build_attribute(atom(), atom(), keyword(), [map()] | nil) :: map()

Builds an attribute map from DSL options.

The key presence varies by type to match existing schema behavior:

  • string: includes caseExact and uniqueness
  • boolean: no caseExact, uniqueness optional (only if explicitly provided)
  • complex: includes subAttributes, mutability, returned, uniqueness
  • reference: includes referenceTypes, caseExact, uniqueness

build_schema(schema_id, name, description, attributes)

@spec build_schema(String.t(), String.t(), String.t(), [map()]) :: map()

Builds the complete schema map from DSL-collected data.

build_sub_attribute(name, type, opts)

@spec build_sub_attribute(atom() | String.t(), atom(), keyword()) :: map()

Builds a sub-attribute map (used inside complex attributes).