module OpenAPI::Generator::Helpers::Lucky

Defined in:

openapi-generator/helpers/lucky.cr
openapi-generator/helpers/lucky/body.cr
openapi-generator/helpers/lucky/query_params.cr
openapi-generator/helpers/lucky/responses.cr

Class Method Summary

Macro Summary

Class Method Detail

def self.bootstrap #

Run this method exactly once before generating the schema to register all the inferred properties.


Macro Detail

macro body_as(type, description = nil, content_type = "application/json", constructor = :from_json) #

Extracts and serialize the body from the request and registers it in the OpenAPI operation.

# This will try to case the body as a SomeClass using the SomeClass.new method and assuming that the payload is a json.
body_as SomeClass, description: "Some payload.", content_type: "application/json", constructor: from_json
# The content_type, constructor and description can be omitted.
body_as SomeClass

macro body_as!(*args, **named_args) #

Same as body_as but will raise if the body is missing or badly formatted.


macro head(status, description = nil, headers = nil, links = nil) #

Declare a head response.


macro json(body, status = 200, description = nil, type = nil, schema = nil, headers = nil, links = nil) #

Declare a json response.


macro param(declaration, description = nil, multiple = false, schema = nil, **args) #

Declare a query parameter.


macro plain_text(body, status = 200, description = nil, type = String, schema = nil, headers = nil, links = nil) #

Declare a plain text response.


macro xml(body, status = 200, description = nil, type = String, schema = nil, headers = nil, links = nil) #

Declare an xml response.