Open erikaaus opened 1 year ago
Question: What are deprecations
?
They're typed as a keyword list of strings.
Question: What's the difference between describe
and docs
?
Question: What is the examples field for?
Question: What is an example of an identifier?
It's mentioned in the moduledoc, but it was automatically added to the typespec by Elixir, so it's listed as term()
.
Question: What are
deprecations
? They're typed as a keyword list of strings.Question: What's the difference between
describe
anddocs
?
deprecations
are specific keys in the schema
that have been deprecated. i.e deprecations: [name: "The name option has been deprecated, use surname"]
instead.
describe
is your user provided documentation. docs
should not be set by the user. It is an internal field.
Question: What is the examples field for?
The examples field allows you to show examples of a given section or entity. For example:
@attribute %Spark.Dsl.Entity{
name: :attribute,
...,
examples: [
"""
attribute :foo, :string
"""
]
}
It should be shown in the automatically generated documentation.
Question: What is an example of an identifier? It's mentioned in the moduledoc, but it was automatically added to the typespec by Elixir, so it's listed as
term()
.
identifier
refers to a field on the entity that it should be unique on. For example, in Ash.Resource
the attribute
resource is unique on :name
. The type should be {:auto, :unique_integer}
to automatically generate a unique integer identifier, or an atom. The {:auto, :unique_integer}
kinda sounds useless at first, but entities with an identifier set on them can be used with Spark.Dsl.Transformer.replace_entity
without having to pass a replacement function, which can be useful where nothing specific identifies a given entity and you have to programatically transform them.
The type should be
{:auto, :unique_integer}
to automatically generate a unique integer identifier, or an atom.
To be clear, is that the type set by the user in their Entity
, or is it the type generated by Spark
if the user opts in?
If the former, I believe the type would be @type id :: {:auto, :unique_integer} | nil
to reflect the fact that a user may opt out of using the identifier?
yes, you are correct 👍
Proposal
This issues is to keep track of improvement ideas for the documentation for
Spark.Dsl.Entity
.Questions
@doc false
these functions, or write documentation for them?Work to be done
@typedocs
on these types.Spark.OptionsHelper
)mfa()
to{module(), function :: atom(), args :: [any()]}