Exports
Exports describe the API in formats that external tools understand. They come from introspection — the same structure that drives runtime validation.
What Exports Do
- Generate specifications — OpenAPI, TypeScript, and Zod from one source
- Stay in sync — when the API changes, exports change with it
- Extend — build custom exports for any format
There is no separate schema to maintain. What runs in production is what gets exported.
Declaration
Declare which exports to enable in the API definition:
ruby
Apiwork::API.define '/api/v1' do
export :openapi
export :typescript
export :zod
endOnce declared, exports can be generated via endpoints, rake tasks, or code.
Next Steps
- Generation — endpoints, rake tasks, and programmatic generation
- OpenAPI — OpenAPI specification export
- TypeScript — TypeScript type definitions
- Zod — Zod schema export
- Custom Exports — building custom export formats
See also
- Export reference — programmatic generation API