# `Oaskit.SpecCacheWarmup`
[🔗](https://github.com/lud/oaskit/blob/v0.17.1/lib/oaskit/spec_cache_warmup.ex#L1)

A child for your supervision tree that builds an OpenAPI specification and
its validators with `Oaskit.warmup_spec_cache/2`.

The build happens synchronously when the supervisor starts the child, so the
application fails at boot if the specification cannot be built. The child
then returns `:ignore` and the supervisor moves on to the next children.

Use this when your specification depends on processes started by your
application, for instance if it loads schemas from the database. Add the
child after those processes, and before your endpoint so the first requests
find the specification already built:

    children = [
      MyApp.Repo,
      {Oaskit.SpecCacheWarmup, spec: MyAppWeb.ApiSpec},
      MyAppWeb.Endpoint
    ]

If your specification reads the runtime configuration of your endpoint, for
instance with `MyAppWeb.Endpoint.url()`, add the child after the endpoint.
The endpoint then accepts requests before the specification is built, and
these requests wait for the build to complete.

### Options

* `:spec` - The spec module to build. Required.
* `:responses` - See `Oaskit.warmup_spec_cache/2`.

---

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