Project

osury: OpenAPI Codegen

An open-source compiler that turns OpenAPI 3.x specifications into typed code together with the runtime decoders that check it. One intermediate representation drives four targets: ReScript with Sury schemas, Effect TS, OCaml and Rust. It runs in production at Nyle, where every backend type in the ReScript domain core is generated rather than hand-written. Key Features: Discriminated Unions: Case tags come from discriminator.mapping, so generated types follow the wire format, not backend class names. Runtime Validation: Every target emits its own decoders — Sury schemas, Effect Schema, yojson codecs, serde. Exact Optionality: An opt-in mode keeps "key absent" apart from "value null", which PATCH bodies need. Compiler-Grade Errors: Each error carries a JSON path, a typed kind and a fix hint. Verified Output: In CI every target is compiled by its own toolchain and must decode sample data generated from the same spec.

osury: OpenAPI Codegen