You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by zregvart <gi...@git.apache.org> on 2017/03/16 14:02:54 UTC
[GitHub] camel pull request #1544: CAMEL-10932 REST Swagger component
GitHub user zregvart opened a pull request:
https://github.com/apache/camel/pull/1544
CAMEL-10932 REST Swagger component
**Please review this, thank you** :1st_place_medal:
This includes the initial implementation of the `rest-swagger` component
that allows for a higher level abstraction over the REST API usage from
other Camel components that implement the `RestProducerFactory` SPI
combined with Swagger (Open API) specifications.
The most simple usage would be:
to("rest-swagger:getPetById")
Which would pick up the Swagger specification from `swagger.json` and
try to find a single component that implements the `RestProducerFactory`
SPI and invoke the `getPetById` operation.
Other way of using this component could be:
to("rest-swagger:http://petstore.swagger.io/v2/swagger.json#getPetById")
That loads the Swagger specification from the
`http://petstore.swagger.io/v2/swagger.json` URL and invokes the
`getPetById` operation.
More concise way of configuring would be to configure most properties
on the component add it to CamelContext, and use only `operationId` path
parameter when triggering the exchange:
// add `petstore` component to the CamelContext
RestSwaggerComponent petstore =
new RestSwaggerComponent(camelContext);
petstore.setSpecificationUri("http://petstore.swagger.io/v2/swagger.json");
petstore.setComponentName("undertow");
camelContext.addComponent("petstore", petstore);
And then use `operationId` in endpoint definition:
ProducerTemplate template = camelContext.getProducerTemplate();
template.requestBodyAndHeaders("petstore:getPetById", null, "petId",
petId);
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/zregvart/camel swagger-awesome-respin
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/camel/pull/1544.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1544
----
commit b68d5553283cd46511147eba200191c5df21c619
Author: Zoran Regvart <zr...@apache.org>
Date: 2017-03-16T11:54:47Z
CAMEL-10932 REST Swagger component
This includes the initial implementation of the `rest-swagger` component
that allows for a higher level abstraction over the REST API usage from
other Camel components that implement the `RestProducerFactory` SPI
combined with Swagger (Open API) specifications.
The most simple usage would be:
to("rest-swagger:getPetById")
Which would pick up the Swagger specification from `swagger.json` and
try to find a single component that implements the `RestProducerFactory`
SPI and invoke the `getPetById` operation.
Other way of using this component could be:
to("rest-swagger:http://petstore.swagger.io/v2/swagger.json#getPetById")
That loads the Swagger specification from the
`http://petstore.swagger.io/v2/swagger.json` URL and invokes the
`getPetById` operation.
More concise way of configuring would be to configure most properties
on the component add it to CamelContext, and use only `operationId` path
parameter when triggering the exchange:
// add `petstore` component to the CamelContext
RestSwaggerComponent petstore =
new RestSwaggerComponent(camelContext);
petstore.setSpecificationUri("http://petstore.swagger.io/v2/swagger.json");
petstore.setComponentName("undertow");
camelContext.addComponent("petstore", petstore);
And then use `operationId` in endpoint definition:
ProducerTemplate template = camelContext.getProducerTemplate();
template.requestBodyAndHeaders("petstore:getPetById", null, "petId",
petId);
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] camel pull request #1544: CAMEL-10932 REST Swagger component
Posted by zregvart <gi...@git.apache.org>.
Github user zregvart closed the pull request at:
https://github.com/apache/camel/pull/1544
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---