Claus Ibsen created CAMEL-27883:
-----------------------------------
Summary: camel-rest-openapi: host and basePath can come from
different servers, several request content types give an invalid Content-Type,
response validation skips headers
Key: CAMEL-27883
URL: https://issues.apache.org/jira/browse/CAMEL-27883
Project: Camel
Issue Type: Bug
Components: camel-rest-openapi
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-rest-openapi for
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31155).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. host and basePath can come from different servers
{{RestOpenApiEndpoint.determineHost}} collects the servers in a HashSet, so
with several absolute servers the host is chosen by hash order, while
{{RestOpenApiHelper.getBasePathFromOpenApi}} takes the last server.
Proposed change: keep the servers in order and take the first one for both.
h4. 2. Several request content types give an invalid Content-Type
When the requestBody has several content types and neither produces nor a
Content-Type header is set, {{determineEndpointParameters}} sends a
comma-joined list (in HashSet order) as Content-Type.
Proposed change: pick one, preferring application/json.
h4. 3. clientResponseValidation skips the response headers
{{RestOpenApiProcessor.createRestBindingConfiguration}} never sets
responseCodes or responseHeaders, so client response validation only checks
that a JSON body parses; the response Content-Type and required response
headers of the spec are not checked, unlike in the Rest DSL.
Proposed change: fill them from operation.getResponses().
h4. 4. TLS options and existing components
With sslContextParameters or useGlobalSslContextParameters, camel-rest
{{RestEndpoint.findFromExistingComponents}} calls
RestProducerFactoryHelper.setupComponent with those properties for every
component already in the context: it logs WARN "Found existing ... Not setting
component properties" for unrelated components, and when http already exists
the TLS settings are not applied (only a WARN).
Proposed change: pass the properties only for the chosen delegate, and fail or
document when it cannot apply them.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)