liboas — library for OpenAPI Specification
OpenAPI 3.2 library for C23
liboas is a C23 library for parsing, validating, and serving OpenAPI 3.2 specifications. Two-layer architecture: OAS Model (parse and represent OpenAPI documents) and Compiled Runtime (pre-compiled validator and router for high-performance request/response validation).
Designed for integration with iohttp via adapter pattern, but usable standalone.
git clone https://github.com/dantte-lp/liboas.git && cd liboas
cmake --preset clang-debug
cmake --build --preset clang-debug
ctest --preset clang-debuggraph TB
subgraph "OAS Model Layer"
PARSE["JSON/YAML Parser"]
MODEL["OAS Document Model"]
REF["$ref Resolver"]
SCHEMA["JSON Schema 2020-12"]
end
subgraph "Compiled Runtime Layer"
COMPILE["Schema Compiler"]
VALID["Request/Response Validator"]
MATCH["Path Matcher"]
EMIT["Spec Emitter (JSON/YAML)"]
end
subgraph "Integration"
ADAPTER["iohttp Adapter"]
SCALAR["Scalar UI"]
end
PARSE --> MODEL
MODEL --> REF --> MODEL
MODEL --> SCHEMA
MODEL --> COMPILE
COMPILE --> VALID
COMPILE --> MATCH
MODEL --> EMIT
ADAPTER --> VALID
ADAPTER --> MATCH
ADAPTER --> EMIT
style COMPILE fill:#6BA539,color:#fff
style VALID fill:#6BA539,color:#fff
- Full OpenAPI 3.2 document model (paths, operations, schemas, components)
- JSON Schema 2020-12 validation (type, format, pattern, min/max, allOf/oneOf/anyOf)
- Pre-compiled schema validators for zero-allocation hot path
$refresolution (local, remote, recursive with cycle detection)- Path template matching with parameter extraction
- Request/response validation middleware
- JSON and YAML spec emission
- iohttp adapter for automatic route validation
- Scalar UI integration for API documentation
Full documentation is available in docs/:
| # | Document | Description |
|---|---|---|
| 01 | Architecture | System architecture, two-layer design |
| 02 | OAS Model | OpenAPI document model, parsing |
| 03 | JSON Schema | JSON Schema 2020-12 validation |
| 04 | Schema Compiler | Pre-compilation, optimization |
| 05 | Validator | Request/response validation |
| 06 | Integration | iohttp adapter, middleware |
| 07 | API Reference | Public API documentation |
| 08 | Development | Dev workflow, testing, quality |
See docs/en/08-development.md for development workflow, coding standards, and testing requirements.
GPLv3 - see LICENSE for details.