[ 
https://issues.apache.org/jira/browse/CAMEL-10932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15928098#comment-15928098
 ] 

ASF GitHub Bot commented on CAMEL-10932:
----------------------------------------

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 <[email protected]>
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);

----


> REST Swagger component
> ----------------------
>
>                 Key: CAMEL-10932
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10932
>             Project: Camel
>          Issue Type: New Feature
>    Affects Versions: 2.19.0
>            Reporter: Zoran Regvart
>            Assignee: Zoran Regvart
>            Priority: Minor
>
> As a result of discussion resulting from CAMEL-10809 ([GitHub PR 
> comment|https://github.com/apache/camel/pull/1454#issuecomment-279324224] a 
> need for a {{rest-swagger}} component has arisen.
> A component that would leverage the SPI support introduced in CAMEL-10164 and 
> create REST endpoints preconfigured with the Swagger specification. This 
> would allow choosing the _client_ component (e.g. http4, jetty, undertow...) 
> and have a higher level abstraction over the REST API.
> I think a good start would getting the Producer support first, and than 
> expand into specification first design for Consumers.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to