Documentation
¶
Index ¶
- Constants
- func ConvertToHttpStatus(code string) (external.HttpStatusCode, error)
- func EnsureHttpStatusCode(code uint) external.HttpStatusCode
- func IsValidHttpStatusCode(code uint) bool
- func IsValidHttpVerb(verb string) bool
- func PermissionStringToFileMod(permissionString string) (os.FileMode, error)
- type AuthorizationFunctionConfig
- type CommonConfig
- type ContentType
- type ControllerMetadata
- type CustomValidators
- type DeprecationOptions
- type ErrorResponse
- type FieldMetadata
- type FuncParam
- type FuncReturnValue
- type GleeceConfig
- type HideMethodType
- type HttpVerb
- type ImportType
- type KnownTemplate
- type MethodHideOptions
- type ModelMetadata
- type OpenAPIGeneratorConfig
- type ParamMeta
- type ParamPassedIn
- type RestMetadata
- type RouteMetadata
- type RouteSecurity
- type RoutesConfig
- type RoutingEngineType
- type SecurityAnnotationComponent
- type SecuritySchemeConfig
- type SecuritySchemeIn
- type SecuritySchemeType
- type SpecGeneratorConfig
- type TypeMetadata
Constants ¶
View Source
const Rfc7807ErrorFullPackage = "github.com/gopher-fleece/gleece/external"
View Source
const Rfc7807ErrorName = "Rfc7807Error"
Variables ¶
This section is empty.
Functions ¶
func ConvertToHttpStatus ¶
func ConvertToHttpStatus(code string) (external.HttpStatusCode, error)
func EnsureHttpStatusCode ¶
func EnsureHttpStatusCode(code uint) external.HttpStatusCode
func IsValidHttpStatusCode ¶
func IsValidHttpVerb ¶
Types ¶
type AuthorizationFunctionConfig ¶
type AuthorizationFunctionConfig struct {
FullPackageName string `json:"fullPackageName" validate:"required,filepath"`
}
type CommonConfig ¶
type CommonConfig struct {
ControllerGlobs []string `json:"controllerGlobs" validate:"omitempty,min=1"`
}
type ContentType ¶
type ContentType string
const ( ContentTypeJSON ContentType = "application/json" ContentTypeXML ContentType = "application/xml" ContentTypeHTML ContentType = "text/html" ContentTypePlainText ContentType = "text/plain" ContentTypeFormURLEncoded ContentType = "application/x-www-form-urlencoded" ContentTypeMultipartForm ContentType = "multipart/form-data" ContentTypeOctetStream ContentType = "application/octet-stream" ContentTypePDF ContentType = "application/pdf" ContentTypePNG ContentType = "image/png" ContentTypeJPEG ContentType = "image/jpeg" ContentTypeGIF ContentType = "image/gif" ContentTypeCSV ContentType = "text/csv" ContentTypeJavaScript ContentType = "application/javascript" ContentTypeCSS ContentType = "text/css" )
type ControllerMetadata ¶
type ControllerMetadata struct { Name string Package string FullyQualifiedPackage string Tag string Description string RestMetadata RestMetadata Routes []RouteMetadata // The default security schema/s used for the controller's operations. // May be overridden at the route level Security []RouteSecurity }
type CustomValidators ¶
type DeprecationOptions ¶
type ErrorResponse ¶
type ErrorResponse struct { HttpStatusCode external.HttpStatusCode Description string }
type FieldMetadata ¶
type FieldMetadata struct { Name string Type string Description string Tag string Deprecation *DeprecationOptions }
type FuncParam ¶
type FuncParam struct { ParamMeta PassedIn ParamPassedIn NameInSchema string Description string UniqueImportSerial uint64 Validator string Deprecation *DeprecationOptions }
type FuncReturnValue ¶
type FuncReturnValue struct { TypeMetadata UniqueImportSerial uint64 }
type GleeceConfig ¶
type GleeceConfig struct { OpenAPIGeneratorConfig OpenAPIGeneratorConfig `json:"openAPIGeneratorConfig" validate:"required"` RoutesConfig RoutesConfig `json:"routesConfig" validate:"required"` CommonConfig CommonConfig `json:"commonConfig" validate:"required"` }
type HideMethodType ¶
type HideMethodType string
const ( HideMethodNever HideMethodType = "Never" HideMethodAlways HideMethodType = "Always" HideMethodCondition HideMethodType = "Condition" )
type ImportType ¶
type ImportType string
const ( ImportTypeNone ImportType = "None" ImportTypeAlias ImportType = "Alias" ImportTypeDot ImportType = "Dot" )
type KnownTemplate ¶
type KnownTemplate string
const ( TemplateRoutes KnownTemplate = "routes" TemplateControllerResponsePartial KnownTemplate = "controller.response.partial" )
type MethodHideOptions ¶
type MethodHideOptions struct { Type HideMethodType Condition string }
type ModelMetadata ¶
type ModelMetadata struct { Name string Package string FullyQualifiedPackage string Description string Fields []FieldMetadata Deprecation DeprecationOptions }
type OpenAPIGeneratorConfig ¶
type OpenAPIGeneratorConfig struct { Info openapi3.Info `json:"info" validate:"required"` BaseURL string `json:"base_url" validate:"required,url"` SecuritySchemes []SecuritySchemeConfig `json:"securitySchemes" validate:"not_nil_array"` DefaultRouteSecurity []RouteSecurity `json:"defaultSecurity" validate:"not_nil_array"` SpecGeneratorConfig SpecGeneratorConfig `json:"specGeneratorConfig" validate:"required"` }
type ParamMeta ¶
type ParamMeta struct { Name string TypeMeta TypeMetadata }
type ParamPassedIn ¶
type ParamPassedIn string
Enum of HTTP parma type (header, query, path, body)
const ( PassedInHeader ParamPassedIn = "Header" PassedInQuery ParamPassedIn = "Query" PassedInPath ParamPassedIn = "Path" PassedInBody ParamPassedIn = "Body" )
type RestMetadata ¶
type RestMetadata struct {
Path string
}
type RouteMetadata ¶
type RouteMetadata struct { // The handler function's and operation name in the OpenAPI schema OperationId string // The HTTP verb this method expects (i.e., GET, POST etc.) HttpVerb HttpVerb // Controls whether the method is hidden in schema and when Hiding MethodHideOptions // Defines whether the method is considered deprecated Deprecation DeprecationOptions // The operation's description Description string // Additional metadata related to the operation such as it's URL RestMetadata RestMetadata // Metadata on the handler function's parameters FuncParams []FuncParam // Metadata on the handler function's return values Responses []FuncReturnValue // Indicates whether the operation returns a value on success. // // Note that the framework enforces at-least an error return value from all controller methods HasReturnValue bool // A description for success responses ResponseDescription string // The HTTP code expected to be returned from a successful call // // TODO: Needs to be an array ResponseSuccessCode external.HttpStatusCode // Metadata on the type of errors that may be returned from the operation ErrorResponses []ErrorResponse // The expected request content type. // // Currently hard-coded to application/json. RequestContentType ContentType // The expected response content type. // // Currently hard-coded to application/json. ResponseContentType ContentType // The security schema/s used for the operation Security []RouteSecurity // OR between security routes }
func (RouteMetadata) GetErrorReturnType ¶
func (m RouteMetadata) GetErrorReturnType() *TypeMetadata
func (RouteMetadata) GetValueReturnType ¶
func (m RouteMetadata) GetValueReturnType() *TypeMetadata
type RouteSecurity ¶
type RouteSecurity struct {
SecurityAnnotation []SecurityAnnotationComponent `json:"securityMethod" validate:"not_nil_array"` // AND between security methods
}
type RoutesConfig ¶
type RoutesConfig struct { Engine RoutingEngineType `json:"engine" validate:"required,oneof=gin"` TemplateOverrides map[KnownTemplate]string `json:"templateOverrides"` OutputPath string `json:"outputPath" validate:"required,filepath"` OutputFilePerms string `json:"outputFilePerms" validate:"regex=^(0?[0-7]{3})?$"` PackageName string `json:"packageName"` CustomValidators []CustomValidators `json:"customValidators" validate:"dive"` AuthorizationFunctionConfig AuthorizationFunctionConfig `json:"authorizationFunctionConfig" validate:"required"` }
type RoutingEngineType ¶
type RoutingEngineType string
const (
RoutingEngineGin RoutingEngineType = "gin"
)
type SecurityAnnotationComponent ¶
type SecurityAnnotationComponent struct { SchemaName string `json:"name" validate:"required,starts_with_letter"` Scopes []string `json:"scopes" validate:"not_nil_array"` }
SecurityAnnotationComponent is the schema-scopes parts of a security annotation; i.e., @Security(AND, [{name: "schema1", scopes: ["read", "write"]}, {name: "schema2", scopes: ["delete"]}])
type SecuritySchemeConfig ¶
type SecuritySchemeConfig struct { Description string `json:"description" validate:"required"` SecurityName string `json:"name" validate:"required,starts_with_letter"` FieldName string `json:"fieldName" validate:"required,starts_with_letter"` Type SecuritySchemeType `json:"type" validate:"required,security_schema_type"` // see SecuritySchemeType In SecuritySchemeIn `json:"in" validate:"required,security_schema_in"` // see SecuritySchemeIn }
type SecuritySchemeIn ¶
type SecuritySchemeIn string
const ( InQuery SecuritySchemeIn = "query" InHeader SecuritySchemeIn = "header" InCookie SecuritySchemeIn = "cookie" )
type SecuritySchemeType ¶
type SecuritySchemeType string
const ( APIKey SecuritySchemeType = "apiKey" OAuth2 SecuritySchemeType = "oauth2" OpenIDConnect SecuritySchemeType = "openIdConnect" HTTP SecuritySchemeType = "http" )
type SpecGeneratorConfig ¶
type SpecGeneratorConfig struct {
OutputPath string `json:"outputPath" validate:"required"`
}
type TypeMetadata ¶
Click to show internal directories.
Click to hide internal directories.