Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-17430

Rest endpoint query parameters not set on underlying endpoint

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.13.0, 3.14.0
    • 3.14.1, 3.15.0
    • camel-rest-openapi
    • None
    • Unknown

    Description

      After upgrading to 3.14.0 I got this error then calling an open api from a route:

      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

      The endpoint used in the route looks like this:

      .to("s-smtp:SendEmail?authUsername={{api.client-id}}&authPassword={{api.client-secret}}&authenticationPreemptive=true&throwExceptionOnFailure=false&bridgeEndpoint=true") 

      After debugging I found that the cause of this is found on line 533 in RestOpenApiEndpoint:

      // 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());
                  }
              }
          }
      } 

      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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              henka-rl Henrik Karlsson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: