openapi

package
v0.0.0-...-4ec28c1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package openapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL     string
	BaseRouter  chi.Router
	Middlewares []MiddlewareFunc
}

type MiddlewareFunc

type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc

type ServerInterface

type ServerInterface interface {
	// Create item
	// (POST /create)
	PostCreate(w http.ResponseWriter, r *http.Request)
	// Delete item
	// (DELETE /delete/{id})
	DeleteDeleteId(w http.ResponseWriter, r *http.Request, id string)
	// Get item
	// (GET /read/{id})
	GetReadId(w http.ResponseWriter, r *http.Request, id string)
	// Search item
	// (GET /search/{q})
	FindItems(w http.ResponseWriter, r *http.Request, q string)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) DeleteDeleteId

func (siw *ServerInterfaceWrapper) DeleteDeleteId(w http.ResponseWriter, r *http.Request)

DeleteDeleteId operation middleware

func (*ServerInterfaceWrapper) FindItems

func (siw *ServerInterfaceWrapper) FindItems(w http.ResponseWriter, r *http.Request)

FindItems operation middleware

func (*ServerInterfaceWrapper) GetReadId

func (siw *ServerInterfaceWrapper) GetReadId(w http.ResponseWriter, r *http.Request)

GetReadId operation middleware

func (*ServerInterfaceWrapper) PostCreate

func (siw *ServerInterfaceWrapper) PostCreate(w http.ResponseWriter, r *http.Request)

PostCreate operation middleware

Jump to

Keyboard shortcuts

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