mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
docs: improve docs/small error message tweak
This commit is contained in:
parent
951c3051b9
commit
0b18be167e
5 changed files with 42 additions and 4 deletions
|
@ -83,6 +83,37 @@ defmodule Ash.DocIndex do
|
|||
end
|
||||
end
|
||||
|
||||
def find_undocumented_items(doc_index) do
|
||||
Enum.each(doc_index.extensions(), fn extension ->
|
||||
Enum.each(
|
||||
extension.module.sections(),
|
||||
&find_undocumented_in_section(&1, [inspect(extension.module)])
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
defp find_undocumented_in_section(section, path) do
|
||||
find_undocumented_in_schema(section.schema(), [section.name() | path])
|
||||
Enum.each(section.sections(), &find_undocumented_in_section(&1, [section.name() | path]))
|
||||
Enum.each(section.entities(), &find_undocumented_in_entity(&1, [section.name() | path]))
|
||||
end
|
||||
|
||||
defp find_undocumented_in_entity(entity, path) do
|
||||
find_undocumented_in_schema(entity.schema(), [entity.name() | path])
|
||||
|
||||
Enum.each(entity.entities(), fn {_key, entities} ->
|
||||
Enum.each(entities, &find_undocumented_in_entity(&1, [entity.name() | path]))
|
||||
end)
|
||||
end
|
||||
|
||||
defp find_undocumented_in_schema(schema, path) do
|
||||
Enum.each(schema, fn {key, opts} ->
|
||||
if !opts[:link] do
|
||||
raise "Undocumented item #{Enum.reverse(path) |> Enum.join(".")}.#{key}"
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
# sobelow_skip ["Traversal.FileModule"]
|
||||
def read!(app, path) do
|
||||
app
|
||||
|
|
|
@ -98,6 +98,9 @@ defmodule Ash.Flow do
|
|||
{:constrained, {:ok, nil}} ->
|
||||
{:cont, {:ok, Map.put(acc, arg.name, nil)}}
|
||||
|
||||
{:constrained, {:error, error}} ->
|
||||
{:halt, {:error, error}}
|
||||
|
||||
{:error, error} ->
|
||||
{:halt, {:error, error}}
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ defmodule Ash.OptionsHelpers do
|
|||
|> NimbleOptions.docs()
|
||||
end
|
||||
|
||||
@non_nimble_options [:hide, :as, :snippet]
|
||||
@non_nimble_options [:hide, :as, :snippet, :links]
|
||||
|
||||
defp sanitize_schema(schema) do
|
||||
Enum.map(schema, fn {key, opts} ->
|
||||
|
|
|
@ -37,11 +37,15 @@ defmodule Ash.Resource.Attribute do
|
|||
@schema [
|
||||
name: [
|
||||
type: :atom,
|
||||
doc: "The name of the attribute."
|
||||
doc: "The name of the attribute.",
|
||||
links: []
|
||||
],
|
||||
type: [
|
||||
type: :ash_type,
|
||||
doc: "The type of the attribute."
|
||||
doc: "The type of the attribute.",
|
||||
links: [
|
||||
modules: ["ash:module:Ash.Type"]
|
||||
]
|
||||
],
|
||||
constraints: [
|
||||
type: :keyword_list,
|
||||
|
|
|
@ -504,7 +504,7 @@ defmodule Ash.Type do
|
|||
|> Enum.with_index()
|
||||
|> Enum.reduce({[], []}, fn {item, index}, {items, errors} ->
|
||||
if is_nil(item) && not nil_items? do
|
||||
{[item | items], [[message: "no nil/null values", index: index] | errors]}
|
||||
{[item | items], [[message: "no nil values", index: index] | errors]}
|
||||
else
|
||||
case apply_constraints(type, item, item_constraints) do
|
||||
{:ok, value} ->
|
||||
|
|
Loading…
Reference in a new issue