openapi

package
v0.0.0-...-60882eb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 14 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.13.0 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
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type PostUserJSONRequestBody

type PostUserJSONRequestBody = User

PostUserJSONRequestBody defines body for PostUser for application/json ContentType.

type PutUsersUserIdJSONRequestBody

type PutUsersUserIdJSONRequestBody = User

PutUsersUserIdJSONRequestBody defines body for PutUsersUserId for application/json ContentType.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type Server

type Server struct{}

func NewServer

func NewServer() *Server

func (*Server) DeleteUsersUserId

func (s *Server) DeleteUsersUserId(w http.ResponseWriter, r *http.Request, userId int)

func (*Server) GetUsersUserId

func (s *Server) GetUsersUserId(w http.ResponseWriter, r *http.Request, userId int)

func (*Server) PostUser

func (s *Server) PostUser(w http.ResponseWriter, r *http.Request)

func (*Server) PutUsersUserId

func (s *Server) PutUsersUserId(w http.ResponseWriter, r *http.Request, userId int)

type ServerInterface

type ServerInterface interface {
	// Create New User
	// (POST /user)
	PostUser(w http.ResponseWriter, r *http.Request)

	// (DELETE /users/{userId})
	DeleteUsersUserId(w http.ResponseWriter, r *http.Request, userId int)
	// Get User Info by User ID
	// (GET /users/{userId})
	GetUsersUserId(w http.ResponseWriter, r *http.Request, userId int)

	// (PUT /users/{userId})
	PutUsersUserId(w http.ResponseWriter, r *http.Request, userId int)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) DeleteUsersUserId

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

DeleteUsersUserId operation middleware

func (*ServerInterfaceWrapper) GetUsersUserId

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

GetUsersUserId operation middleware

func (*ServerInterfaceWrapper) PostUser

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

PostUser operation middleware

func (*ServerInterfaceWrapper) PutUsersUserId

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

PutUsersUserId operation middleware

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshallingParamError

type UnmarshallingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshallingParamError) Error

func (e *UnmarshallingParamError) Error() string

func (*UnmarshallingParamError) Unwrap

func (e *UnmarshallingParamError) Unwrap() error

type User

type User struct {
	// CreateDate The date that the user was created.
	CreateDate  *openapi_types.Date `json:"createDate,omitempty"`
	DateOfBirth openapi_types.Date  `json:"dateOfBirth"`
	Email       openapi_types.Email `json:"email"`
	FirstName   string              `json:"firstName"`

	// Id Unique identifier for the given user.
	Id       *int   `json:"id,omitempty"`
	LastName string `json:"lastName"`
}

User defines model for User.

func CreateDummyUser

func CreateDummyUser() *User

Jump to

Keyboard shortcuts

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