View Source OpenAPI.Processor.Operation (OpenAPI Generator v0.1.1)

Default plugin for formatting operations

This module also provides the Operation struct that is used by the renderer.

Link to this section Summary

Types

HTTP method

Request content types and their associated schemas

Request content types and their associated schema specs

Response status codes and their associated schemas

Response status codes and their associated schema specs

t()

Processed operation data used by the renderer

Default Implementations

Create the contents of an @doc string for the given operation

Collect request content types and their associated schemas

Cast the HTTP method to an atom

Collect response status codes and their associated schemas

Link to this section Types

@type method() :: :get | :put | :post | :delete | :options | :head | :patch | :trace

HTTP method

@type request_body() :: [
  {content_type :: String.t(), schema :: OpenAPI.Processor.Type.t()}
]

Request content types and their associated schemas

Link to this type

request_body_unprocessed()

View Source
@type request_body_unprocessed() :: [
  {content_type :: String.t(), schema :: OpenAPI.Spec.Schema.t()}
]

Request content types and their associated schema specs

@type response_body() :: [
  {status :: integer() | :default,
   schemas :: %{required(String.t()) => OpenAPI.Processor.Type.t()}}
]

Response status codes and their associated schemas

Link to this type

response_body_unprocessed()

View Source
@type response_body_unprocessed() :: [
  {status :: integer() | :default,
   schemas :: %{required(String.t()) => OpenAPI.Spec.Schema.t()}}
]

Response status codes and their associated schema specs

@type t() :: %OpenAPI.Processor.Operation{
  docstring: String.t(),
  function_name: atom(),
  module_name: atom(),
  request_body: request_body(),
  request_method: atom(),
  request_path: String.t(),
  request_path_parameters: [OpenAPI.Processor.Operation.Param.t()],
  request_query_parameters: [OpenAPI.Processor.Operation.Param.t()],
  responses: response_body()
}

Processed operation data used by the renderer

Link to this section Default Implementations

Link to this function

docstring(state, operation, query_params)

View Source

Create the contents of an @doc string for the given operation

Default implementation of OpenAPI.Processor.operation_docstring/3.

The docstring constructed by this function will contain a summary line provided by the operation summary (if available) or the request method and path otherwise. It will incorporate the operation description (if available) and link to any included external documentation. Finally, all query parameters (which are part of the opts argument) are documented.

@doc """
Summary of the operation or method and path

Description of the operation, which generally provides more information.

## Options

  * `param`: query parameter description

## Resources

  * [External Doc Description](link to external documentation)

"""
Link to this function

request_body(state, arg2)

View Source

Collect request content types and their associated schemas

Default implementation of OpenAPI.Processor.operation_request_body/2.

Link to this function

request_method(state, operation)

View Source

Cast the HTTP method to an atom

Default implementation of OpenAPI.Processor.operation_request_method/2.

Link to this function

response_body(state, operation)

View Source

Collect response status codes and their associated schemas

Default implementation of OpenAPI.Processor.operation_response_body/2.

In this implementation, all schemas are returned regardless of content type. It is possible for the same status code to have multiple schemas, in which case the renderer should compose a union type for the response.