Aller au contenu

OpenAPI Export

Ce contenu n’est pas encore disponible dans votre langue.

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.

When the server is running, the spec is available at:

EndpointDescription
GET /_openapiOpenAPI 3.0 spec as JSON

Export the spec to a file without starting the server:

Terminal window
yrest openapi db.yml
yrest openapi db.yml --output openapi.json
yrest openapi db.yml --output openapi.yaml

yRest infers field types from the live data in db.yml. Explicit _schema declarations override the inferred types.

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>