module OpenAPI::Generator::Controller
Overview
This module, when included, will register every instance methods annotated with the OpenAPI
annotation.
Example
class Controller
include OpenAPI::Generator::Controller
@[OpenAPI(<<-YAML
tags:
- tag
summary: A brief summary of the method.
requestBody:
content:
#{Schema.ref SerializableClass}
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/SerializableClass'
required: true
responses:
"303":
description: Operation completed successfully, and redirects to /.
"404":
description: Data not found.
#{Schema.error 400}
YAML
)]
def method; end
end
Usage
Including this module will register and mark every instance method annotated with a valid @[OpenAPI]
annotation during the compilation phase.
These methods will then be taken into account when calling the Generator
as long as the method can be mapped to a route.
The Schema
module contains various helpers to generate YAML parts.
Defined in:
openapi-generator/controller.crConstant Summary
-
CONTROLLER_OPS =
{} of String => YAML::Any