Current section

Files

Jump to
ash_json_api documentation dsls DSL:-AshJsonApi.Api.cheatmd
Raw

documentation/dsls/DSL:-AshJsonApi.Api.cheatmd

<!--
This file was generated by Spark. Do not edit it by hand.
-->
# DSL: AshJsonApi.Api
The entrypoint for adding JSON:API behavior to an Ash API
## json_api
Global configuration for JSON:API
### Nested DSLs
* [open_api](#json_api-open_api)
### Examples
```
json_api do
prefix "/json_api"
log_errors? true
end
```
### Options
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th colspan=2>Docs</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a id="json_api-router" href="#json_api-router">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
router
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The router that you created for this Api. Use by test helpers to send requests
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="json_api-prefix" href="#json_api-prefix">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
prefix
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The route prefix at which you are serving the JSON:API
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="json_api-serve_schema?" href="#json_api-serve_schema?">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
serve_schema?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
</td>
<td style="text-align: left">
<code class="inline">false</code>
</td>
<td style="text-align: left" colspan=2>
Whether or not create a /schema route that serves the JSON schema of your API
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="json_api-authorize?" href="#json_api-authorize?">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
authorize?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
</td>
<td style="text-align: left">
<code class="inline">true</code>
</td>
<td style="text-align: left" colspan=2>
Whether or not to perform authorization for this API
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="json_api-log_errors?" href="#json_api-log_errors?">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
log_errors?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
</td>
<td style="text-align: left">
<code class="inline">true</code>
</td>
<td style="text-align: left" colspan=2>
Whether or not to log any errors produced
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="json_api-include_nil_values?" href="#json_api-include_nil_values?">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
include_nil_values?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
</td>
<td style="text-align: left">
<code class="inline">true</code>
</td>
<td style="text-align: left" colspan=2>
Whether or not to include properties for values that are nil in the JSON output
</td>
</tr>
</tbody>
</table>
## json_api.open_api
OpenAPI configurations
### Examples
```
json_api do
...
open_api do
tag "Users"
group_by :api
end
end
```
### Options
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th colspan=2>Docs</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a id="json_api-open_api-tag" href="#json_api-open_api-tag">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
tag
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
Tag to be used when used by :group_by
</td>
</tr>
<tr>
<td style="text-align: left">
<a id="json_api-open_api-group_by" href="#json_api-open_api-group_by">
<span style="font-family: Inconsolata, Menlo, Courier, monospace;">
group_by
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">:api | :resource</code>
</td>
<td style="text-align: left">
<code class="inline">:resource</code>
</td>
<td style="text-align: left" colspan=2>
Group by :api or :resource
</td>
</tr>
</tbody>
</table>