class WarpEngine::Api::Admin::DocumentsController
Serves the Admin API’s OpenAPI 3.1 document and its HTML reference page. When the host sets openapi_requires_auth, both need an admin token with the read scope (401 without a token, 403 without the scope).
Public Instance Methods
Source
# File app/controllers/warp_engine/api/admin/documents_controller.rb, line 28 def docs raise WarpEngine::AdminApi::Error.not_found unless admin_config.docs_ui? authorize_document! document = WarpEngine::AdminApi::OpenApi.document(server_url: server_url) render plain: WarpEngine::AdminApi::DocsPage.render(document), content_type: "text/html" end
GET <admin path>/docs.
Renders the HTML API reference page built from the OpenAPI document. Responds 404 unless the host enabled the docs UI.
Source
# File app/controllers/warp_engine/api/admin/documents_controller.rb, line 13 def openapi authorize_document! document = WarpEngine::AdminApi::OpenApi.document(server_url: server_url) if params[:format] == "yaml" render plain: document.deep_stringify_keys.to_yaml, content_type: "application/yaml" else render json: document end end
GET <admin path>/openapi.json and GET <admin path>/openapi.yaml.
Renders the OpenAPI document of every registered operation, with the server URL of this deployment, as JSON or (for the yaml format) as application/yaml.