You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/01/05 06:15:00 UTC

[jira] [Resolved] (CAMEL-17430) Rest endpoint query parameters not set on underlying endpoint

     [ https://issues.apache.org/jira/browse/CAMEL-17430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-17430.
---------------------------------
    Fix Version/s: 3.15.0
                   3.14.1
       Resolution: Fixed

> Rest endpoint query parameters not set on underlying endpoint
> -------------------------------------------------------------
>
>                 Key: CAMEL-17430
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17430
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-rest-openapi
>    Affects Versions: 3.13.0, 3.14.0
>            Reporter: Henrik Karlsson
>            Priority: Major
>             Fix For: 3.15.0, 3.14.1
>
>
> After upgrading to 3.14.0 I got this error then calling an open api from a route:
> {noformat}
> Invalid url: /camel/api/v1/register. If you are forwarding/bridging http endpoints, then enable the bridgeEndpoint option on the endpoint: http://localhost:8093/s-smtp/v1/email?httpMethod=POST{noformat}
> The endpoint used in the route looks like this:
> {code:java}
> .to("s-smtp:SendEmail?authUsername={{api.client-id}}&authPassword={{api.client-secret}}&authenticationPreemptive=true&throwExceptionOnFailure=false&bridgeEndpoint=true") {code}
> After debugging I found that the cause of this is found on line 533 in RestOpenApiEndpoint:
> {code:java}
> // Add rest endpoint parameters
> if (this.parameters != null && operation.getParameters() != null) {
>     for (Map.Entry<String, Object> entry : this.parameters.entrySet()) {
>         for (OasParameter param : operation.getParameters()) {
>             // skip parameters that are part of the operation as path as otherwise
>             // it will be duplicated as query parameter as well
>             boolean clash = "path".equals(param.in) && entry.getKey().equals(param.getName());
>             if (!clash) {
>                 nestedParameters.put(entry.getKey(), entry.getValue());
>             }
>         }
>     }
> } {code}
> If the operation in question don't have any parameters this.parameters will never be added to the underlying endpoint.
> Found this change in this commit:
> https://github.com/apache/camel/commit/94847d8c4a84e39be31c38ca30a5f4a3575ece29#diff-f9d1965ec0771a782838b7a5c10c2e6e228fb6f4ce0776172488638a63d8a611R529



--
This message was sent by Atlassian Jira
(v8.20.1#820001)