Java Code Examples for io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory#addHandlerByOperationId()

The following examples show how to use io.vertx.ext.web.api.contract.openapi3.OpenAPI3RouterFactory#addHandlerByOperationId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenAPI3Examples.java    From vertx-web with Apache License 2.0 6 votes vote down vote up
public void addOperationModelKey(OpenAPI3RouterFactory routerFactory, RouterFactoryOptions options) {
  // Configure the operation model key and set options in router factory
  options.setOperationModelKey("operationPOJO");
  routerFactory.setOptions(options);

  // Add an handler that uses the operation model
  routerFactory.addHandlerByOperationId("listPets", routingContext -> {
    io.swagger.v3.oas.models.Operation operation = routingContext.get("operationPOJO");

    routingContext
      .response()
      .setStatusCode(200)
      .setStatusMessage("OK")
      // Write the response with operation id "listPets"
      .end(operation.getOperationId());
  });
}
 
Example 2
Source File: SpaceApi.java    From xyz-hub with Apache License 2.0 5 votes vote down vote up
public SpaceApi(OpenAPI3RouterFactory routerFactory) {
  routerFactory.addHandlerByOperationId("getSpace", this::getSpace);
  routerFactory.addHandlerByOperationId("getSpaces", this::getSpaces);
  routerFactory.addHandlerByOperationId("postSpace", this::postSpace);
  routerFactory.addHandlerByOperationId("patchSpace", this::patchSpace);
  routerFactory.addHandlerByOperationId("deleteSpace", this::deleteSpace);
}
 
Example 3
Source File: FeatureApi.java    From xyz-hub with Apache License 2.0 5 votes vote down vote up
public FeatureApi(OpenAPI3RouterFactory routerFactory) {
  routerFactory.addHandlerByOperationId("getFeature", this::getFeature);
  routerFactory.addHandlerByOperationId("getFeatures", this::getFeatures);
  routerFactory.addHandlerByOperationId("putFeature", this::putFeature);
  routerFactory.addHandlerByOperationId("putFeatures", this::putFeatures);
  routerFactory.addHandlerByOperationId("postFeatures", this::postFeatures);
  routerFactory.addHandlerByOperationId("patchFeature", this::patchFeature);
  routerFactory.addHandlerByOperationId("deleteFeature", this::deleteFeature);
  routerFactory.addHandlerByOperationId("deleteFeatures", this::deleteFeatures);
}
 
Example 4
Source File: FeatureQueryApi.java    From xyz-hub with Apache License 2.0 5 votes vote down vote up
public FeatureQueryApi(OpenAPI3RouterFactory routerFactory) {
  routerFactory.addHandlerByOperationId("getFeaturesBySpatial", this::getFeaturesBySpatial);
  routerFactory.addHandlerByOperationId("getFeaturesBySpatialPost", this::getFeaturesBySpatial);
  routerFactory.addHandlerByOperationId("getFeaturesByBBox", this::getFeaturesByBBox);
  routerFactory.addHandlerByOperationId("getFeaturesByTile", this::getFeaturesByTile);
  routerFactory.addHandlerByOperationId("getFeaturesCount", this::getFeaturesCount);
  routerFactory.addHandlerByOperationId("getStatistics", this::getStatistics);
  routerFactory.addHandlerByOperationId("iterateFeatures", this::iterateFeatures);
  routerFactory.addHandlerByOperationId("searchForFeatures", this::searchForFeatures);
}
 
Example 5
Source File: OpenAPI3Examples.java    From vertx-web with Apache License 2.0 5 votes vote down vote up
public void addRoute(Vertx vertx, OpenAPI3RouterFactory routerFactory) {
  routerFactory.addHandlerByOperationId("awesomeOperation", routingContext -> {
    RequestParameters params = routingContext.get("parsedParameters");
    RequestParameter body = params.body();
    JsonObject jsonBody = body.getJsonObject();
    // Do something with body
  });
  routerFactory.addFailureHandlerByOperationId("awesomeOperation", routingContext -> {
    // Handle failure
  });
}