OpenAPI Export
Questi contenuti non sono ancora disponibili nella tua lingua.
yRest generates a live OpenAPI 3.0 specification from your db.yml file. Every collection, relation, and custom route is reflected in the spec automatically — no annotations required.
The /_openapi endpoint
Section titled “The /_openapi endpoint”When the server is running, the spec is available at:
| Endpoint | Description |
|---|---|
GET /_openapi | OpenAPI 3.0 spec as JSON |
yrest openapi command
Section titled “yrest openapi command”Export the spec to a file without starting the server:
yrest openapi db.ymlyrest openapi db.yml --output openapi.jsonyrest openapi db.yml --output openapi.yamlWhat is included
Section titled “What is included”Schema inference
Section titled “Schema inference”yRest infers field types from the live data in db.yml. Explicit _schema declarations override the inferred types.
Swagger UI integration
Section titled “Swagger UI integration”Point Swagger UI at /_openapi while yRest is running:
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css" /><div id="swagger-ui"></div><script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script><script> SwaggerUIBundle({ url: "http://localhost:3070/_openapi", dom_id: "#swagger-ui" });</script>Postman import
Section titled “Postman import”Limitations
Section titled “Limitations”Next steps
Section titled “Next steps”- Field Schema — use
_schemato add types and constraints that appear in the spec - CLI Reference —
yrest openapicommand reference - Programmatic API — access the spec from Node.js test code