Ash.Api.Dsl (ash v1.48.0-rc.12) View Source
A small DSL for declaring APIs
Apis are the entrypoints for working with your resources.
Apis may optionally include a list of resources, in which case they can be
used as an Ash.Registry
in various places. This is for backwards compatibility,
but if at all possible you should define an Ash.Registry
if you are using an extension
that requires a list of resources. For example, most extensions look for two application
environment variables called :ash_apis
and :ash_registries
to find any potential registries
Table of Contents
- resources
- resource
resources
List the resources present in this API
Examples:
resources do
resource MyApp.User
resource MyApp.Post
resource MyApp.Comment
end
:define_interfaces?
- If set to true, the code interface of each resource will be defined in the api.
Keep in mind that this can increase the compile times of your application. The default value isfalse
.:registry
- Allows declaring that only the modules in a certain registry should be allowed to work with this Api.
This option is ignored if any explicit resources are included in the api, so everything is either in the registry or in the api. See the docs onAsh.Registry
for what the registry is used for.
resource
A reference to a resource
Introspection Target:
Examples:
resource MyApp.User
:resource
- Required. The module of the resource