new OpenAPI3RouterFactory()
Interface for OpenAPI3RouterFactory.
Methods
addFailureHandler(method, path, failureHandler) → {DesignDrivenRouterFactory}
Add a failure handler to a path with a method. If combination path/method is not available in
specification, it will throw a
Parameters:
| Name | Type | Description |
|---|---|---|
method |
Object | |
path |
string | |
failureHandler |
function |
Returns:
- Type
- DesignDrivenRouterFactory
addFailureHandlerByOperationId(operationId, failureHandler) → {OpenAPI3RouterFactory}
Add a failure handler by operation_id field in Operation object
Parameters:
| Name | Type | Description |
|---|---|---|
operationId |
string | |
failureHandler |
function |
Returns:
- Type
- OpenAPI3RouterFactory
addHandler(method, path, handler) → {DesignDrivenRouterFactory}
Add an handler to a path with a method. If combination path/method is not available in
specification, it will throw a
Parameters:
| Name | Type | Description |
|---|---|---|
method |
Object | |
path |
string | |
handler |
function |
Returns:
- Type
- DesignDrivenRouterFactory
addHandlerByOperationId(operationId, handler) → {OpenAPI3RouterFactory}
Add an handler by operation_id field in Operation object
Parameters:
| Name | Type | Description |
|---|---|---|
operationId |
string | |
handler |
function |
Returns:
- Type
- OpenAPI3RouterFactory
addSecurityHandler(securitySchemaName, handler) → {DesignDrivenRouterFactory}
Mount to paths that have to follow a security schema a security handler
Parameters:
| Name | Type | Description |
|---|---|---|
securitySchemaName |
string | |
handler |
function |
Returns:
- Type
- DesignDrivenRouterFactory
addSecuritySchemaScopeValidator(securitySchemaName, scopeName, handler) → {OpenAPI3RouterFactory}
Add a particular scope validator. The main security schema will not be called if a specific scope validator is
configured
Parameters:
| Name | Type | Description |
|---|---|---|
securitySchemaName |
string | |
scopeName |
string | |
handler |
function |
Returns:
- Type
- OpenAPI3RouterFactory
enableValidationFailureHandler(enable) → {DesignDrivenRouterFactory}
Enable or disable validation failure handler. If you enable it, during router creation it will be mounted a
built-in (or custom with function )
ValidationException handler as a failure handler. If failure is different from ValidationException, it will be
called the next failure handler.
Parameters:
| Name | Type | Description |
|---|---|---|
enable |
boolean |
Returns:
- Type
- DesignDrivenRouterFactory
getRouter() → {Router}
Construct a new router based on spec. It will fail if you are trying to mount a spec with security schemes
without assigned handlers
Note: Router is constructed in this function, so it will be respected the path definition ordering.
Note: Router is constructed in this function, so it will be respected the path definition ordering.
Returns:
- Type
- Router
mountOperationsWithoutHandlers(enable) → {DesignDrivenRouterFactory}
Automatic mount handlers that return HTTP 501 status code for operations where you didn't specify an handler.
Parameters:
| Name | Type | Description |
|---|---|---|
enable |
boolean |
Returns:
- Type
- DesignDrivenRouterFactory
setValidationFailureHandler(handler) → {DesignDrivenRouterFactory}
Set default validation failure handler. You can disable this feature from
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function |
Returns:
- Type
- DesignDrivenRouterFactory