OpenAPI3RouterFactory

Interface for OpenAPI3RouterFactory. <br/> To add an handler, use @see \io\vertx\jphp\ext\web\api\contract\openapi3\OpenAPI3RouterFactory::addHandlerByOperationId<br/> Usage example: <pre> <code>OpenAPI3RouterFactory.create(vertx, "src/resources/spec.yaml", asyncResult -> { if (!asyncResult.succeeded()) { // IO failure or spec invalid</code> else { OpenAPI3RouterFactory routerFactory = asyncResult.result(); routerFactory.addHandlerByOperationId("operation_id", routingContext -> { // Do something }, routingContext -> { // Do something with failure handler }); Router router = routerFactory.getRouter(); } }); } </pre> <br/> Handlers are loaded in this order:<br/> <ol> <li>Body handler (Customizable with </li> <li>Custom global handlers configurable with </li> <li>Global security handlers defined in upper spec level</li> <li>Operation specific security handlers</li> <li>Generated validation handler</li> <li>User handlers or "Not implemented" handler</li> </ol>

package

Default

Methods

__construct

__construct() 

Add a failure handler by operation_id field in Operation object

addFailureHandlerByOperationId( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

this factory

Add global handler to be applied prior to @see \io\vertx\jphp\ext\web\Router being generated. <br/> Please note that you should not add a body handler inside that list. If you want to modify the body handler, please use

addGlobalHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

this object

Add an handler by operation_id field in Operation object

addHandlerByOperationId( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

this factory

Mount to paths that have to follow a security schema a security handler

addSecurityHandler( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

Add a particular scope validator. The main security schema will not be called if a specific scope validator is configured

addSecuritySchemaScopeValidator( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

string

$arg2

callable

Response

$this

this factory

Create a new OpenAPI3RouterFactory

create( $arg0,  $arg1,  $arg2,  $arg3 = null) : void
static

param $vertx [Vertx] param $url [string] location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol) param $handler [callable] When specification is loaded, this handler will be called with AsyncResult create($vertx, $url, $handler)

Create a new OpenAPI3RouterFactory

param $vertx [Vertx] param $url [string] location of your spec. It can be an absolute path, a local path or remote url (with HTTP protocol) param $auth [array] list of authorization values needed to access the remote url. Each item should be json representation of an \AuthorizationValue param $handler [callable] When specification is loaded, this handler will be called with AsyncResult create($vertx, $url, $auth, $handler)

Arguments

$arg0

Vertx

$arg1

string

$arg2

callable | array

$arg3

callable

Get options of router factory. For more info

getOptions() : \io\vertx\jphp\ext\web\api\contract\RouterFactoryOptions

Construct a new router based on spec. It will fail if you are trying to mount a spec with security schemes without assigned handlers<br/> <b>Note:</b> Router is constructed in this function, so it will be respected the path definition ordering.

getRouter() : \io\vertx\jphp\ext\web\Router

getValidationFailureHandler

getValidationFailureHandler() : callable

Response

callable

Specify to route an incoming request for specified operation id to a Web Api Service mounted at the specified address on event bus. Please give a look at <a href="https://vertx.io/docs/vertx-web-api-service/java/">vertx-web-api-service documentation</a> for more informations

mountOperationToEventBus( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

string

Response

$this

this factory

Specify to route an incoming request for all operations that contains the specified tag to a Web Api Service mounted at the specified address on event bus.

mountServiceFromTag( $arg0,  $arg1) : $this

The request is handled by the method that matches the operation id. Please give a look at vertx-web-api-service documentation for more informations

Arguments

$arg0

string

$arg1

string

Response

$this

this factory

Introspect the OpenAPI spec to mount handlers for all operations that specifies a x-vertx-event-bus annotation. Please give a look at <a href="https://vertx.io/docs/vertx-web-api-service/java/">vertx-web-api-service documentation</a> for more informations

mountServicesFromExtensions() : $this

Response

$this

this factory

Supply your own BodyHandler if you would like to control body limit, uploads directory and deletion of uploaded files

setBodyHandler( $arg0) : $this

Arguments

$arg0

BodyHandler

Response

$this

self

When set, this function is called while creating the payload of @see \io\vertx\jphp\ext\web\api\OperationRequest

setExtraOperationContextPayloadMapper( $arg0) : $this

Arguments

$arg0

callable

Response

$this

Set not implemented failure handler. It's called when you don't define an handler for a specific operation. You can enable/disable this feature from

setNotImplementedFailureHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

this object

Set options of router factory. For more info

setOptions( $arg0) : $this

Arguments

$arg0

array | RouterFactoryOptions

Response

$this

Set default validation failure handler. You can enable/disable this feature from

setValidationFailureHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

this object