Documentation
¶
Index ¶
- type BaseBuilder
- type ContentType
- type M
- type Method
- type OpenAPI
- type OpenAPIComponents
- type OpenAPIContact
- type OpenAPIInfo
- type OpenAPILicense
- type OpenAPIMediaType
- type OpenAPIOperation
- type OpenAPIParameter
- type OpenAPIPathItem
- type OpenAPIRequestBody
- type OpenAPIResponse
- type OpenAPIServer
- type R
- type Route
- type Router
- func (r *Router) Delete(prefix string, routeDefinition R, middlewares ...M)
- func (r *Router) Get(prefix string, routeDefinition R, middlewares ...M)
- func (r *Router) Group(prefix string, group func(*Router), middlewares ...M)
- func (r *Router) Patch(prefix string, routeDefinition R, middlewares ...M)
- func (r *Router) Post(prefix string, routeDefinition R, middlewares ...M)
- func (r *Router) Put(prefix string, routeDefinition R, middlewares ...M)
- func (r *Router) Routes() []Route
- func (r *Router) Static(prefix, root string, options ...fiber.Static)
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseBuilder ¶
type BaseBuilder struct {
// contains filtered or unexported fields
}
BaseBuilder is the core builder in here all the routes and middlewares are rememberd
type ContentType ¶
type ContentType uint8
ContentType represends a content type
const ( // JSON is a content type JSON ContentType = iota // HTML is a content type HTML )
func (ContentType) String ¶
func (c ContentType) String() string
type M ¶
type M struct { Tags []Tag Fn fiber.Handler }
M gives this package more information about a middleware
type OpenAPI ¶
type OpenAPI struct { OpenAPI string `json:"openapi"` // Version Info *OpenAPIInfo `json:"info,omitempty"` Servers []OpenAPIServer `json:"servers,omitempty"` Paths map[string]OpenAPIPathItem `json:"paths,omitempty"` Components *OpenAPIComponents `json:"components,omitempty"` // Security []OpenAPISecurityRequirement `json:"security,omitempty"` // TODO Tags []Tag `json:"tags,omitempty"` }
OpenAPI implements the root OpenAPI Response Object Ref: https://swagger.io/specification/#oas-object
type OpenAPIComponents ¶
OpenAPIComponents implements the OpenAPI Components Ref: https://swagger.io/specification/#components-object
type OpenAPIContact ¶
type OpenAPIContact struct { Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` Email string `json:"email,omitempty"` }
OpenAPIContact implements the OpenAPI Contact Object Ref: https://swagger.io/specification/#contact-object
type OpenAPIInfo ¶
type OpenAPIInfo struct { Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` TermsOfService string `json:"termsOfService,omitempty"` Contact OpenAPIContact `json:"contact,omitempty"` License OpenAPILicense `json:"license,omitempty"` Version string `json:"version,omitempty"` }
OpenAPIInfo contains information about the API. Ref: https://swagger.io/specification/#info-object
type OpenAPILicense ¶
type OpenAPILicense struct { Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` }
OpenAPILicense implements the OpenAPI License Object Ref: https://swagger.io/specification/#license-object
type OpenAPIMediaType ¶
type OpenAPIMediaType struct { Schema any `json:"schema,omitempty"` Example any `json:"example,omitempty"` Examples map[string]any `json:"examples,omitempty"` }
OpenAPIMediaType implements the me OpenAPI Media Type Object Ref: https://swagger.io/specification/#media-type-object
type OpenAPIOperation ¶
type OpenAPIOperation struct { Tags []string `json:"tags,omitempty"` Summary string `json:"summary,omitempty"` Description string `json:"description,omitempty"` // ExternalDocs any `json:"externalDocs,omitempty"` // TODO OperationID string `json:"operationId,omitempty"` Parameters []OpenAPIParameter `json:"parameters,omitempty"` RequestBody *OpenAPIRequestBody `json:"requestBody,omitempty"` Responses map[string]OpenAPIResponse `json:"responses,omitempty"` // Callbacks any `json:"callbacks,omitempty"` // TODO Deprecated bool `json:"deprecated,omitempty"` // Security []OpenAPISecurityRequirement `json:"security,omitempty"` // TODO Servers []OpenAPIServer `json:"servers,omitempty"` }
OpenAPIOperation implements the OpenAPI Operation Object Ref: https://swagger.io/specification/#operation-object
type OpenAPIParameter ¶
type OpenAPIParameter struct { Name string `json:"name,omitempty"` In string `json:"in,omitempty"` Description string `json:"description,omitempty"` Required bool `json:"required,omitempty"` Deprecated bool `json:"deprecated,omitempty"` AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` // Style string `json:"style,omitempty"` Explode bool `json:"explode,omitempty"` AllowReserved bool `json:"allowReserved,omitempty"` Schema any `json:"schema,omitempty"` Example any `json:"example,omitempty"` Examples any `json:"examples,omitempty"` }
OpenAPIParameter implements the OpenAPI Parameter Object Ref: https://swagger.io/specification/#parameter-object
type OpenAPIPathItem ¶
type OpenAPIPathItem struct { Ref string `json:"$ref,omitempty"` Summary string `json:"summary,omitempty"` Description string `json:"description,omitempty"` Get *OpenAPIOperation `json:"get,omitempty"` Put *OpenAPIOperation `json:"put,omitempty"` Post *OpenAPIOperation `json:"post,omitempty"` Delete *OpenAPIOperation `json:"delete,omitempty"` Options *OpenAPIOperation `json:"options,omitempty"` Head *OpenAPIOperation `json:"head,omitempty"` Patch *OpenAPIOperation `json:"patch,omitempty"` Trace *OpenAPIOperation `json:"trace,omitempty"` Servers []OpenAPIServer `json:"servers,omitempty"` Parameters []OpenAPIParameter `json:"parameters,omitempty"` }
OpenAPIPathItem implements the OpenAPI Path Item Object Ref: https://swagger.io/specification/#path-item-object
type OpenAPIRequestBody ¶
type OpenAPIRequestBody struct { Description string `json:"description,omitempty"` Content map[string]OpenAPIMediaType `json:"content,omitempty"` Required bool `json:"required,omitempty"` }
OpenAPIRequestBody implements the OpenAPI Request Body Object Ref: https://swagger.io/specification/#request-body-object
type OpenAPIResponse ¶
type OpenAPIResponse struct { Description string `json:"description,omitempty"` // Headers map[string]OpenAPIHeader // TODO Content map[string]OpenAPIMediaType `json:"content,omitempty"` }
OpenAPIResponse implements the OpenAPI Response Object Ref: https://swagger.io/specification/#response-object
type OpenAPIServer ¶
type OpenAPIServer struct { URL string `json:"url,omitempty"` Description string `json:"description,omitempty"` }
OpenAPIServer implements the OpenAPI Server Object Ref: https://swagger.io/specification/#server-object
type R ¶
type R struct { // Required // You can also use markdown in this field :^) Description string // Res gives the routes Res any // OR use res map if there are multiple possible responses ResMap map[string]any // OR use a completely custom OpenAPIResponse type CustomResponse *OpenAPIResponse // The main handler for the route Fn fiber.Handler // Optional // Body can be set to hint the route builder what kind of body this request expects Body any Tags []Tag }
R gives this package more information about a route From the fiber handler (fn(c *fiber.Ctx) error) we cannot know the expected input and output data
type Route ¶
type Route struct { FiberPath string OpenAPIPath string Params []string Kind string Method Method ResponseContentType ContentType Info R }
Route constains information about a route
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router can be used to define routes and middlwares
func (*Router) Group ¶
Group prefixes the routes within the group with a route and adds a middleware to them if specified