schemas

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

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

Code generated by github.com/discord-gophers/goapi-gen version (devel) DO NOT EDIT.

Index

Constants

View Source
const (
	AccessTokenScopes = "access_token.Scopes"
)

Variables

View Source
var (
	UnknownEnumInObjInArrayVal = EnumInObjInArrayVal{}

	EnumInObjInArrayValFirst = EnumInObjInArrayVal{"first"}

	EnumInObjInArrayValSecond = EnumInObjInArrayVal{"second"}
)

Defines values for EnumInObjInArrayVal.

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, opts ...ServerOption) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

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 AnyType1

type AnyType1 interface{}

AnyType1 defines model for AnyType1.

type AnyType2

type AnyType2 interface{}

AnyType2 represents any type.

This should be an interface{}

type CustomGoType added in v0.2.1

type CustomGoType normal.CustomGoType

CustomGoType defines model for CustomGoType.

type CustomGoTypeWithAlias added in v0.2.1

type CustomGoTypeWithAlias customAlias.CustomGoType

CustomGoTypeWithAlias defines model for CustomGoTypeWithAlias.

type CustomStringType

type CustomStringType string

CustomStringType defines model for CustomStringType.

type EnumInObjInArray

type EnumInObjInArray []struct {
	Val *EnumInObjInArrayVal `json:"val,omitempty"`
}

EnumInObjInArray defines model for EnumInObjInArray.

type EnumInObjInArrayVal

type EnumInObjInArrayVal struct {
	// contains filtered or unexported fields
}

EnumInObjInArrayVal defines model for EnumInObjInArray.Val.

func (*EnumInObjInArrayVal) FromValue

func (t *EnumInObjInArrayVal) FromValue(value string) error

func (EnumInObjInArrayVal) MarshalJSON

func (t EnumInObjInArrayVal) MarshalJSON() ([]byte, error)

func (*EnumInObjInArrayVal) ToValue

func (t *EnumInObjInArrayVal) ToValue() string

func (*EnumInObjInArrayVal) UnmarshalJSON

func (t *EnumInObjInArrayVal) UnmarshalJSON(data []byte) error

type GenericObject

type GenericObject map[string]interface{}

GenericObject defines model for GenericObject.

type GetPr66Params added in v0.2.1

type GetPr66Params struct {
	Foo normal.CustomGoType `json:"foo"`
}

GetPr66Params defines parameters for GetPr66.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	// contains filtered or unexported fields
}

func (InvalidParamFormatError) Error added in v0.2.0

func (err InvalidParamFormatError) Error() string

Error implements error.

func (InvalidParamFormatError) ParamName added in v0.2.0

func (err InvalidParamFormatError) ParamName() string

func (InvalidParamFormatError) Unwrap added in v0.2.0

func (err InvalidParamFormatError) Unwrap() error

type Issue185JSONBody

type Issue185JSONBody NullableProperties

Issue185JSONBody defines parameters for Issue185.

type Issue185JSONRequestBody

type Issue185JSONRequestBody Issue185JSONBody

Issue185JSONRequestBody defines body for Issue185 for application/json ContentType.

func (Issue185JSONRequestBody) Bind

Bind implements render.Binder.

type Issue9JSONBody

type Issue9JSONBody interface{}

Issue9JSONBody defines parameters for Issue9.

type Issue9JSONRequestBody

type Issue9JSONRequestBody Issue9JSONBody

Issue9JSONRequestBody defines body for Issue9 for application/json ContentType.

type Issue9Params

type Issue9Params struct {
	Foo string `json:"foo"`
}

Issue9Params defines parameters for Issue9.

type N5startsWithNumber

type N5startsWithNumber map[string]interface{}

This schema name starts with a number

type NullableProperties

type NullableProperties struct {
	Optional            *string `json:"optional,omitempty"`
	OptionalAndNullable *string `json:"optionalAndNullable"`
	Required            string  `json:"required"`
	RequiredAndNullable *string `json:"requiredAndNullable"`
}

NullableProperties defines model for NullableProperties.

type ParameterError added in v0.2.0

type ParameterError interface {
	error
	// ParamName is the name of the parameter that the error is referring to.
	ParamName() string
}

ParameterName is an interface that is implemented by error types that are relevant to a specific parameter.

type PostPr66Params added in v0.2.1

type PostPr66Params struct {
	Bar normal.CustomGoType `json:"bar"`
}

PostPr66Params defines parameters for PostPr66.

type RequiredHeaderError

type RequiredHeaderError struct {
	// contains filtered or unexported fields
}

func (RequiredHeaderError) Error added in v0.2.0

func (err RequiredHeaderError) Error() string

Error implements error.

func (RequiredHeaderError) ParamName added in v0.2.0

func (err RequiredHeaderError) ParamName() string

type RequiredParamError

type RequiredParamError struct {
	// contains filtered or unexported fields
}

func (RequiredParamError) Error added in v0.2.0

func (err RequiredParamError) Error() string

Error implements error.

func (RequiredParamError) ParamName added in v0.2.0

func (err RequiredParamError) ParamName() string

func (RequiredParamError) Unwrap added in v0.2.0

func (err RequiredParamError) Unwrap() error

type Response

type Response struct {
	Code int
	// contains filtered or unexported fields
}

Response is a common response struct for all the API calls. A Response object may be instantiated via functions for specific operation responses. It may also be instantiated directly, for the purpose of responding with a single status code.

func EnsureEverythingIsReferencedJSON200Response

func EnsureEverythingIsReferencedJSON200Response(body struct {
	AnyType1 *AnyType1 `json:"anyType1,omitempty"`

	// AnyType2 represents any type.
	//
	// This should be an interface{}
	AnyType2         *AnyType2         `json:"anyType2,omitempty"`
	CustomStringType *CustomStringType `foo:"bar" json:"customStringType,omitempty"`
}) *Response

EnsureEverythingIsReferencedJSON200Response is a constructor method for a EnsureEverythingIsReferenced response. A *Response is returned with the configured status code and content type from the spec.

func GetIssues375JSON200Response

func GetIssues375JSON200Response(body EnumInObjInArray) *Response

GetIssues375JSON200Response is a constructor method for a GetIssues375 response. A *Response is returned with the configured status code and content type from the spec.

func GetPr66JSON200Response added in v0.2.1

func GetPr66JSON200Response(body CustomGoType) *Response

GetPr66JSON200Response is a constructor method for a GetPr66 response. A *Response is returned with the configured status code and content type from the spec.

func Issue127JSON200Response

func Issue127JSON200Response(body GenericObject) *Response

Issue127JSON200Response is a constructor method for a Issue127 response. A *Response is returned with the configured status code and content type from the spec.

func Issue127JSONDefaultResponse

func Issue127JSONDefaultResponse(body GenericObject) *Response

Issue127JSONDefaultResponse is a constructor method for a Issue127 response. A *Response is returned with the configured status code and content type from the spec.

func Issue127XML200Response

func Issue127XML200Response(body GenericObject) *Response

Issue127XML200Response is a constructor method for a Issue127 response. A *Response is returned with the configured status code and content type from the spec.

func Issue127YAML200Response

func Issue127YAML200Response(body GenericObject) *Response

Issue127YAML200Response is a constructor method for a Issue127 response. A *Response is returned with the configured status code and content type from the spec.

func PostPr66JSON200Response added in v0.2.1

func PostPr66JSON200Response(body CustomGoTypeWithAlias) *Response

PostPr66JSON200Response is a constructor method for a PostPr66 response. A *Response is returned with the configured status code and content type from the spec.

func (*Response) ContentType

func (resp *Response) ContentType(contentType string) *Response

ContentType is a builder method to override the default content type for a response.

func (*Response) MarshalJSON

func (resp *Response) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. This is used to only marshal the body of the response.

func (*Response) MarshalXML

func (resp *Response) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface. This is used to only marshal the body of the response.

func (*Response) Render

func (resp *Response) Render(w http.ResponseWriter, r *http.Request) error

Render implements the render.Renderer interface. It sets the Content-Type header and status code based on the response definition.

func (*Response) Status

func (resp *Response) Status(code int) *Response

Status is a builder method to override the default status code for a response.

type ServerInterface

type ServerInterface interface {

	// (GET /ensure-everything-is-referenced)
	EnsureEverythingIsReferenced(w http.ResponseWriter, r *http.Request) *Response

	// (GET /issues/127)
	Issue127(w http.ResponseWriter, r *http.Request) *Response

	// (GET /issues/185)
	Issue185(w http.ResponseWriter, r *http.Request) *Response

	// (GET /issues/209/${str})
	Issue209(w http.ResponseWriter, r *http.Request, str StringInPath) *Response

	// (GET /issues/30/{fallthrough})
	Issue30(w http.ResponseWriter, r *http.Request, pFallthrough string) *Response

	// (GET /issues/375)
	GetIssues375(w http.ResponseWriter, r *http.Request) *Response

	// (GET /issues/41/{1param})
	Issue41(w http.ResponseWriter, r *http.Request, n1param N5startsWithNumber) *Response

	// (GET /issues/9)
	Issue9(w http.ResponseWriter, r *http.Request, params Issue9Params) *Response

	// (GET /pr/66)
	GetPr66(w http.ResponseWriter, r *http.Request, params GetPr66Params) *Response

	// (POST /pr/66)
	PostPr66(w http.ResponseWriter, r *http.Request, params PostPr66Params) *Response
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

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

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) EnsureEverythingIsReferenced

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

EnsureEverythingIsReferenced operation middleware

func (*ServerInterfaceWrapper) GetIssues375

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

GetIssues375 operation middleware

func (*ServerInterfaceWrapper) GetPr66 added in v0.2.1

GetPr66 operation middleware

func (*ServerInterfaceWrapper) Issue127

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

Issue127 operation middleware

func (*ServerInterfaceWrapper) Issue185

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

Issue185 operation middleware

func (*ServerInterfaceWrapper) Issue209

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

Issue209 operation middleware

func (*ServerInterfaceWrapper) Issue30

Issue30 operation middleware

func (*ServerInterfaceWrapper) Issue41

Issue41 operation middleware

func (*ServerInterfaceWrapper) Issue9

Issue9 operation middleware

func (*ServerInterfaceWrapper) PostPr66 added in v0.2.1

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

PostPr66 operation middleware

type ServerOption

type ServerOption func(*ServerOptions)

func WithErrorHandler

func WithErrorHandler(handler func(w http.ResponseWriter, r *http.Request, err error)) ServerOption

func WithRouter

func WithRouter(r chi.Router) ServerOption

func WithServerBaseURL

func WithServerBaseURL(url string) ServerOption

type ServerOptions

type ServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StringInPath

type StringInPath string

StringInPath defines model for StringInPath.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	NumValues int
	// contains filtered or unexported fields
}

func (TooManyValuesForParamError) Error added in v0.2.0

func (err TooManyValuesForParamError) Error() string

Error implements error.

func (TooManyValuesForParamError) ParamName added in v0.2.0

func (err TooManyValuesForParamError) ParamName() string

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	// contains filtered or unexported fields
}

func (UnescapedCookieParamError) Error added in v0.2.0

func (err UnescapedCookieParamError) Error() string

Error implements error.

func (UnescapedCookieParamError) ParamName added in v0.2.0

func (err UnescapedCookieParamError) ParamName() string

func (UnescapedCookieParamError) Unwrap added in v0.2.0

func (err UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	// contains filtered or unexported fields
}

func (UnmarshalingParamError) Error added in v0.2.0

func (err UnmarshalingParamError) Error() string

Error implements error.

func (UnmarshalingParamError) ParamName added in v0.2.0

func (err UnmarshalingParamError) ParamName() string

func (UnmarshalingParamError) Unwrap added in v0.2.0

func (err UnmarshalingParamError) Unwrap() error

Directories

Path Synopsis
types

Jump to

Keyboard shortcuts

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