mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
improvement: allow adding non-public attributes to explicit accept lists
docs: update upgrade guide
This commit is contained in:
parent
8175de4304
commit
f885a0753f
2 changed files with 4 additions and 15 deletions
|
@ -379,6 +379,10 @@ There is no longer a `private?` option for attributes, relationships, calculatio
|
||||||
|
|
||||||
If you are using api extensions (i.e `AshGraphql` and `AshJsonApi`), you will need to go to your resources and "invert" the definitions. i.e _remove_ `private?: true` and _add_ `public?: true` to _every other_ attribute, _relationship_ and _calculation_. Don't forget the relationships and calculations!
|
If you are using api extensions (i.e `AshGraphql` and `AshJsonApi`), you will need to go to your resources and "invert" the definitions. i.e _remove_ `private?: true` and _add_ `public?: true` to _every other_ attribute, _relationship_ and _calculation_. Don't forget the relationships and calculations!
|
||||||
|
|
||||||
|
> ### Embedded resources too! {:.WARNING}
|
||||||
|
>
|
||||||
|
> The above includes embedded resources as well! Don't forget to make sure that all fields on your embedded resources are also marked as `public?: true` (if applicable). The goal here is to have a clear visual indicator of what in your application can be shown publically.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Anonymous calculations now operate on a list, just like module calculations
|
### Anonymous calculations now operate on a list, just like module calculations
|
||||||
|
|
|
@ -71,21 +71,6 @@ defmodule Ash.Resource.Transformers.DefaultAccept do
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
accept
|
|
||||||
|> Enum.reject(&(&1 in public_attribute_names))
|
|
||||||
|> case do
|
|
||||||
[] ->
|
|
||||||
:ok
|
|
||||||
|
|
||||||
invalid_attrs ->
|
|
||||||
raise Spark.Error.DslError,
|
|
||||||
module: Spark.Dsl.Transformer.get_persisted(dsl_state, :module),
|
|
||||||
path: [:actions, action.name, :accept],
|
|
||||||
message: """
|
|
||||||
Cannot accept #{inspect(invalid_attrs)}, because they are not public attributes.
|
|
||||||
"""
|
|
||||||
end
|
|
||||||
|
|
||||||
accept =
|
accept =
|
||||||
Enum.reject(accept, &(&1 in argument_names))
|
Enum.reject(accept, &(&1 in argument_names))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue