openapi

package
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 10 Imported by: 25 modules, 12 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package openapi provides documentation collector.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	BasePath string // URL path to docs, default "/docs/".
	// contains filtered or unexported fields
}

Collector extracts OpenAPI documentation from HTTP handler and underlying use case interactor.

func (*Collector) Annotate

func (c *Collector) Annotate(method, pattern string, setup ...func(op *openapi3.Operation) error)

Annotate adds OpenAPI operation configuration that is applied during collection.

func (*Collector) Collect

func (c *Collector) Collect(
	method, pattern string,
	u usecase.Interactor,
	h rest.HandlerTrait,
	annotations ...func(*openapi3.Operation) error,
) (err error)

Collect adds use case handler to documentation.

func (*Collector) ProvideRequestJSONSchemas

func (c *Collector) ProvideRequestJSONSchemas(
	method string,
	input interface{},
	mapping rest.RequestMapping,
	validator rest.JSONSchemaValidator,
) error

ProvideRequestJSONSchemas provides JSON Schemas for request structure.

func (*Collector) ProvideResponseJSONSchemas

func (c *Collector) ProvideResponseJSONSchemas(
	statusCode int,
	contentType string,
	output interface{},
	headerMapping map[string]string,
	validator rest.JSONSchemaValidator,
) error

ProvideResponseJSONSchemas provides JSON schemas for response structure.

func (*Collector) Reflector

func (c *Collector) Reflector() *openapi3.Reflector

Reflector is an accessor to OpenAPI Reflector instance.

func (*Collector) ServeHTTP

func (c *Collector) ServeHTTP(rw http.ResponseWriter, _ *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL