Skip to content

Commit 1c5a6c9

Browse files
committed
chore: update docs
1 parent 7bbd29c commit 1c5a6c9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

documentation/dsls/DSL-AshJsonApi.Resource.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ end
6969
| [`default_fields`](#json_api-default_fields){: #json_api-default_fields } | `list(atom)` | | The fields to include in the object if the `fields` query parameter does not specify. Defaults to all public |
7070
| [`derive_sort?`](#json_api-derive_sort?){: #json_api-derive_sort? } | `boolean` | `true` | Whether or not to derive a sort parameter based on the sortable fields of the resource |
7171
| [`derive_filter?`](#json_api-derive_filter?){: #json_api-derive_filter? } | `boolean` | `true` | Whether or not to derive a filter parameter based on the sortable fields of the resource |
72-
| [`attribute_names`](#json_api-attribute_names){: #json_api-attribute_names } | `keyword \| (any -> any)` | | Renames attributes (and calculations/aggregates) in the JSON:API output and input. Can be a keyword list of `[ash_name: :json_api_name]` mappings, or a 1-arity function that receives an atom field name and returns the desired JSON:API name (atom or string). The function form is useful for applying a blanket transformation such as camelCase: ```elixir attribute_names fn name -> name \|> to_string() \|> Macro.camelize() \|> String.downcase_first() end ``` Or with a keyword list: ```elixir attribute_names [ first_name: :firstName, last_name: :lastName ] ``` Names are applied consistently across serialization, request parsing, sort/filter parameters, field selection, error source pointers, and schema generation. |
72+
| [`field_names`](#json_api-field_names){: #json_api-field_names } | `keyword \| (any -> any)` | | Renames fields (attributes, relationships, calculations, and aggregates) in the JSON:API output and input. Can be a keyword list of `[ash_name: :json_api_name]` mappings, or a 1-arity function that receives an atom field name and returns the desired JSON:API name (atom or string). The function form is useful for applying a blanket transformation such as camelCase: ```elixir field_names fn name -> camelized = name \|> to_string() \|> Macro.camelize() {first, rest} = String.split_at(camelized, 1) String.downcase(first) <> rest end ``` Or with a keyword list: ```elixir field_names [ first_name: :firstName, last_name: :lastName ] ``` Names are applied consistently across serialization, request parsing, sort/filter parameters, field selection, error source pointers, relationship keys, and schema generation. |
7373
| [`argument_names`](#json_api-argument_names){: #json_api-argument_names } | `keyword \| (any, any -> any)` | | Renames action arguments in the JSON:API request body and schema. Can be a nested keyword list of `[action_name: [ash_name: :json_api_name]]` mappings, or a 2-arity function that receives `(action_name, argument_name)` atoms and returns the desired JSON:API name (atom or string). ```elixir argument_names [ create: [my_arg: :myArg], update: [my_arg: :myArg] ] ``` Or with a function: ```elixir argument_names fn _action, name -> name \|> to_string() \|> Macro.camelize() \|> String.downcase_first() end ``` |
7474

7575

0 commit comments

Comments
 (0)