AshTypescript.Rpc.Codegen.TypeGenerators.RestrictedSchema
(ash_typescript v0.17.2)
Copy Markdown
View Source
Generates restricted resource schemas based on allowed_loads/denied_loads options.
When an RPC action has load restrictions, this module generates action-specific TypeScript schema types that only expose allowed fields, providing compile-time type safety for field selection.
Supports nested restrictions on:
- Relationships (e.g.,
denied_loads: [user: [:todos]]) - Embedded resources (e.g.,
denied_loads: [metadata: [:related_user]]) - Union attributes (e.g.,
denied_loads: [content: [:author]])
Summary
Functions
Returns the schema reference and optional schema definition for an RPC action.
Functions
Returns the schema reference and optional schema definition for an RPC action.
If the action has load restrictions, returns {schema_definition, schema_name}.
If no restrictions, returns {nil, base_resource_schema_name}.
Parameters
resource- The Ash resource modulerpc_action- The RPC action configuration structrpc_action_name_pascal- The PascalCase name of the RPC action
Returns
{schema_definition, schema_reference}where:schema_definitionis a string with TypeScript type def or nil if using base schemaschema_referenceis the TypeScript type name to use in Fields type