OpenAPI Greeter Demo
The openapi.server operator allows REST services to be exposed from a graph. It can expose the endpoint as a swagger-driven service endpoint or a plain REST service endpoint. This example demonstrates its swagger-driven mode. The exposed service is described by a swagger document and the request messages are handled based on this document.
Configure and Run the Graph
Follow the steps below to run the example from the Data Pipeline UI:
- Start the graph. This demo service will be started at path /openapi/service/samples/greeter relative to the vflow instance URL.
- Open the UI from the wiretap operator so that the request messages are displayed on the browser.
- Open the url /openapi/service/samples/greeter/swagger.json to retrieve its swagger document. (If you are using Chrome swagger-plugin, you can directly view this document and invoke the operations. Otherwise, use another tool to invoke these REST operations described in the document.)
For example, when using curl, these correspond to:
curl http://{host}:{port}/{path}/openapi/service/samples/greeter/v1/ping curl -X -d 'some text' http://{host}:{port}/{path}/openapi/service/samples/greeter/v1/echo