From models to hosted OpenAPI Specification (OAS)
ฝัง
- เผยแพร่เมื่อ 13 ม.ค. 2025
- Karel van der Walt
PostgresConf South Africa 2019
postgresconf.o...
Translate a data model of a domain into a hosted, fully functional OpenAPI Specification (OAS)
with minimal coding by integrating PostgreSQL with PostgREST and NGINX.
This presentation goes beyond a trivial CRUD (Create/Read/Update/Delete) API reflected from the schema,
to a State Model of a domain entity and its life cycle. It is rather the PostgreSQL functions
achieving the state transitions in the entity life cycle, that are exposed as idempotent API endpoints.
Hence the API is realised entirely in
PL/pgSQL coding and
configuration of PostgREST and NGINX.
Each API endpoint emits a JSON document assembled via PostgreSQL JSON functions, representing the domain entity in its current state.
The emitted JSON document is manipulated and presented to the next API endpoint as determined by the required state transition.
API Requests are authenticated via JSON Web Tokens (JWT).