# `Infusion.Spec`
[🔗](https://github.com/mandar1045/infusion/blob/v0.1.0/lib/infusion/spec.ex#L1)

Loads an OpenAPI document from a file or a URL.

    {:ok, spec} = Infusion.Spec.load("openapi.json")
    {:ok, spec} = Infusion.Spec.load("https://example.com/openapi.yaml")

JSON and YAML are both accepted, told apart by content rather than by file
extension. Prefer JSON when a vendor publishes both: it is about 50 times
faster to parse. YAML is read with full YAML type resolution, so `true`,
`false` and `null` arrive as booleans and `nil` (a faster YAML library was
measured returning them as strings, which silently changes meaning, e.g.
`additionalProperties: "false"`).

Only OpenAPI 3.0 and 3.1 are supported.

# `t`

```elixir
@type t() :: %Infusion.Spec{document: map(), source: String.t(), version: String.t()}
```

# `load`

```elixir
@spec load(String.t(), keyword()) :: {:ok, t()} | {:error, String.t()}
```

Loads and checks an OpenAPI document.

## Options

  * `:req_options` - extra options for `Req.get/2` when `source` is a URL.

---

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