Documentation ¶
Index ¶
Constants ¶
View Source
const ( FS_ROUTING_BODY_PARAM = "_body" FS_ROUTING_METHOD_PARAM = "_method" FS_ROUTING_INDEX_MODULE = "index" + inoxconsts.INOXLANG_FILE_EXTENSION )
View Source
const (
MAX_PATH_PARAM_COUNT = 5
)
Variables ¶
View Source
var ( ErrEndpointNotFound = errors.New("endpoint not found") ErrAPINotFinalized = errors.New("API value is not finalized") ErrAPIAlreadyFinalized = errors.New("API value is already finalized") ErrAPIBeingFinalized = errors.New("API value is being finalized") )
View Source
var ( ErrFailedCreateApiFromOApenpiSpec = errors.New("failed to create API from Open API/Swagger specification") ErrUnsupportedMediaTypeinSpec = errors.New("unsupported media type (in spec)") ErrOpenAPIV2SpecNotSupported = errors.New("specification in the Open Api 2.0 & Swagger formats are not supported, see https://converter.swagger.io/#/Converter/convertByContent to convert to OpenAPI 3+ format") )
View Source
var ( METHODS_WITH_NO_BODY = []string{"GET", "HEAD", "OPTIONS"} METHODS = []string{"GET", "HEAD", "OPTIONS", "PUT", "POST", "PATCH", "DELETE"} FS_ROUTING_METHODS = []string{"GET", "OPTIONS", "POST", "PATCH", "PUT", "DELETE"} METHOD_PATTERN = core.NewUnionPattern(utils.MapSlice(METHODS, func(s string) core.Pattern { return core.NewExactValuePattern(core.Identifier(s)) }), nil) )
View Source
var ( ErrUnexpectedBodyParamsInGETHandler = errors.New("unexpected request body parmameters in GET handler") ErrUnexpectedBodyParamsInOPTIONSHandler = errors.New("unexpected request body parmameters in OPTIONS handler") ErrUnexpectedBodyParamsInCatchAllHandler = errors.New("unexpected request body parmameters in catch-all handler") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is a high level type that contains several endpoints, it is immutable.
func GetFSRoutingServerAPI ¶
func NewEmptyAPI ¶
func NewEmptyAPI() *API
func (*API) ForEachHandlerModule ¶
func (api *API) ForEachHandlerModule(visit HandlerModuleVisitFn) error
ForEachHandlerModule visits all handler modules in the API. If $endpoint.CatchAll() is true the handler handles all operations and $operation is not set.
func (*API) GetEndpoint ¶
func (api *API) GetEndpoint(path string) (*ApiEndpoint, error)
type ApiEndpoint ¶
type ApiEndpoint struct {
// contains filtered or unexported fields
}
APIEndpoint represents an endpoint and its supported operations (GET, POST, ...). APIEndpoint is immutable.
func (ApiEndpoint) CatchAll ¶
func (e ApiEndpoint) CatchAll() bool
func (ApiEndpoint) CatchAllHandler ¶
func (e ApiEndpoint) CatchAllHandler() (*core.Module, bool)
func (ApiEndpoint) GetPathParams ¶
func (e ApiEndpoint) GetPathParams(path string) (params PathParams, count int, err error)
func (ApiEndpoint) Operations ¶
func (e ApiEndpoint) Operations() []ApiOperation
func (ApiEndpoint) PathWithParams ¶
func (e ApiEndpoint) PathWithParams() string
type ApiOperation ¶
type ApiOperation struct {
// contains filtered or unexported fields
}
func (ApiOperation) HandlerModule ¶
func (op ApiOperation) HandlerModule() (*core.Module, bool)
func (ApiOperation) HttpMethod ¶
func (op ApiOperation) HttpMethod() string
func (ApiOperation) JSONRequestBodyPattern ¶
func (op ApiOperation) JSONRequestBodyPattern() (core.Pattern, bool)
type EndpointPathSegment ¶
type EndpointTreeNode ¶
type EndpointTreeNode struct {
// contains filtered or unexported fields
}
type HandlerModuleVisitFn ¶
type HandlerModuleVisitFn func( mod *core.Module, endpoint *ApiEndpoint, operation ApiOperation, ) error
type PathParams ¶
type PathParams [5]PathParam
type ServerApiResolutionConfig ¶
type ServerApiResolutionConfig struct {
IgnoreModulesWithErrors bool
}
Click to show internal directories.
Click to hide internal directories.