# `WardrikRest.OpenAPI.Schema`

Turns OpenAPI 3.0 and 3.1 schemas into JSON Schema for `WardrikRest.Spec`.

  * A reference to `#/components/schemas/NAME` stays a reference, as `%{"$ref" => "NAME"}`.
    Other references within the document are followed; references to other files are left as
    any value.
  * Fields the API only returns (`readOnly`) are left out, with them in `required`.
  * Kept: `type`, `enum`, `const`, `pattern`, `description`, `properties`, `required`, `items`,
    `additionalProperties`, `oneOf`, `anyOf` and `allOf`. `nullable` and a `"null"` type are
    dropped, as a tool's arguments may leave a field out.

# `json`

```elixir
@spec json(map() | boolean(), map()) :: map()
```

Returns `schema`, from `document`, as JSON Schema.

# `resolve`

```elixir
@spec resolve(map(), map()) :: map()
```

Follows `node`'s reference within `document`, to a parameter, a request body or any other
object. Returns `node` itself when it isn't a reference, and `%{}` when it can't be followed.

# `types`

```elixir
@spec types(map()) :: %{required(String.t()) =&gt; map()}
```

Returns the document's `components/schemas` as types, by name.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
