Autonoma.Schema (Autonoma v0.2.9)

Copy Markdown View Source

Build the SDK's wire-shape schema from registered factories.

The dashboard's discover response carries a schema block that lists every model the host can create, along with each model's fields. With the factory-driven design, this comes from each factory's input_fields list rather than SQL introspection.

Summary

Functions

Build the SDK's discover-time schema from registered factories.

Map an Elixir type atom to the SDK's coarse type string.

Serialise a schema info map to the JSON shape the dashboard expects.

Functions

build_schema_from_factories(factories, scope_field)

Build the SDK's discover-time schema from registered factories.

factories is a map of %{model_name => factory_definition}. Each factory definition must include input_fields.

edges and relations are emitted as empty lists. They were populated from FK introspection in the old design; here the create payload's _alias / _ref graph carries equivalent information at request time.

field_type_from_annotation(type)

Map an Elixir type atom to the SDK's coarse type string.

The SDK emits a handful of canonical names (string, integer, number, boolean, timestamp, date, uuid, json) so the dashboard can render appropriate input controls.

schema_to_wire(schema)

Serialise a schema info map to the JSON shape the dashboard expects.

Field names in the wire JSON are camelCase (e.g. isRequired).