# `Hyper.Firecracker.Api.Codec`
[🔗](https://github.com/harmont-dev/hyper/blob/main/lib/hyper/firecracker/api/codec.ex#L1)

Compile-time JSON codec injected into every generated schema via the
generator's `schema_use` option.

`oapi_generator` emits each schema's struct and its `__fields__/1` type
metadata, but no code that moves data on or off the wire. This macro fills
both directions at compile time, so each schema carries its own conversion:

  * encode -- a `Jason.Encoder` implementation that omits unset (`nil`) and
    internal (`:__info__`) fields, because Firecracker rejects some explicit
    nulls and absent optionals must simply not be sent.
  * decode -- a `decode/1` specialized from the schema's `__fields__/1` (read
    via `@before_compile`, since the function can't be called during its own
    module's compilation). Field casts are baked in: nested schemas and lists
    dispatch to their own generated `decode/1`, everything else passes through.
    No runtime type reflection.

---

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