vibe.web.internal.rest.common

Internal module with common functionality for REST interface generators.

Types 8

structRestInterface(TImpl, bool support_webparam_attributes = true) if (is(TImpl == class) || is(TImpl == interface))

Provides all necessary tools to implement an automated REST interface.

The given TImpl must be an interface or a class deriving from one.

Fields
RestInterfaceSettings settingsThe settings used to generate the interface
string basePathFull base path of the interface, including an eventual `@path` annotation.
string baseURLFull base URL of the interface, including an eventual `@path` annotation.
[__traits(allMembers, I)] memberNamesThe name of each interface member
RouteFunctions.length routeCount
Route[routeCount] routesInformation about each route
SubInterfaceFunctions.length subInterfaceCount
SubInterface[subInterfaceCount] subInterfacesInformation about sub interfaces
Methods
private void computeRoutes()
auto getRoutesGroupedByPattern()Returns an array with routes grouped by path pattern
private StaticRoute[routeCount] computeStaticRoutes()
private void computeSubInterfaces()
private string computeDefaultPath(alias method)(string name)
Constructors
this(RestInterfaceSettings settings, bool is_client)Fills the struct with information.
Nested Templates
GetSubInterfaceFunctions()
GetSubInterfaceTypes()
GetRouteFunctions()
GetAllMethods()
structRoute
Fields
string functionName
HTTPMethod method
string pattern
string fullPattern
bool pathHasPlaceholders
PathPart[] pathParts
PathPart[] fullPathParts
Parameter[] parameters
Parameter wholeBodyParameter
Parameter[] queryParameters
Parameter[] bodyParameters
Parameter[] headerParameters
Parameter[] attributedParameters
Parameter[] internalParameters
Parameter[] authParameters
Parameter[] statusParameters
structPathPart
Fields
bool isParameterinterpret `text` as a parameter name (including the leading underscore) or as raw text
string text
structParameter
Fields
string name
string fieldName
bool isIn
Fields
string functionName
string rawName
bool pathOverride
HTTPMethod method
StaticParameter[] parameters
Fields
string name
string fieldName
bool isIn
query
body_
wholeBody
header
attributed
internal
auth
status

Functions 2

private fnbool extractPathParts(ref PathPart[] parts, string pattern) @safe
private fnstatic auto getRoutesGroupedByPatternImpl(scope Route[] routes)

Templates 2

tmplSubInterfaceType(alias F)
tmplWebParamUDATuple(alias Func, size_t idx)

Get an UDATuple of WebParamAttribute at the index

This is evil complicated magic.

https://forum.dlang.org/post/qdmpfg$14f5$1@digitalmars.com