You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/09/23 13:43:25 UTC

[PR] CAMEL-24825: fix REST OpenAPI missing/pathless servers entry [camel]

gnodet opened a new pull request, #26801:
URL: https://github.com/apache/camel/pull/26801

   ## Summary
   
   Fix REST DSL from an OpenAPI contract failing when the `servers` list is missing or contains a URL with no path component.
   
   ## Root Cause
   
   `RestOpenApiHelper.getBasePathFromOpenApi()` returns:
   - `null` when `servers` is `null` or empty (no servers entry at all)
   - `""` (empty string) when a server URL has no path component (e.g. `http://localhost:8080`)
   
   Both `RestOpenApiHelper.determineBasePath()` and `RestOpenApiEndpoint.determineBasePath()` used `isNotEmpty(specificationBasePath)` to check the return value. Since `isNotEmpty("")` is `false`, a pathless server URL (returning `""`) was incorrectly treated as "not present", causing both methods to fall through to `DEFAULT_BASE_PATH` (`"/"`).
   
   When the spec has **no servers entry at all**, the fallback to `"/"` then flows into `createConsumerFor` as `rest:METHOD:/:template`. The `:` in that URI pattern triggers a JDK-level `URISyntaxException: URI is not absolute` during consumer creation, preventing the route from starting.
   
   ## Fix
   
   In both `determineBasePath` methods:
   - Only fall back to `DEFAULT_BASE_PATH` when `openapi.getServers()` is `null` or empty (truly unspecified)
   - When servers are present, use a `!= null` guard instead of `isNotEmpty`, so an empty string base path (from a pathless server URL) is correctly honoured
   
   ## Tests Added (`RestOpenApiEndpointV3Test`)
   
   - `shouldDetermineEmptyBasePathFromOpenApiServer` — verifies that `http://localhost:8080` (no path) produces `""` via `getBasePathFromOpenApi`, `endpoint.determineBasePath`, and `RestOpenApiHelper.determineBasePath`
   - `shouldDefaultBasePathWhenNoServersInSpec` — verifies that a spec with no servers entry at all still falls back correctly to `"/"` (the `DEFAULT_BASE_PATH`)
   
   ## Related
   
   - Fixes [CAMEL-24825](https://issues.apache.org/jira/browse/CAMEL-24825)
   - Related closed PR: #26755 (same root cause, similar fix approach)
   
   ---
   _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24825: fix REST OpenAPI missing/pathless servers entry [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26801:
URL: https://github.com/apache/camel/pull/26801#issuecomment-5795983756

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: Apache Camel Committers, please review the following items:
   
     * First-time contributors **require MANUAL approval** for the GitHub Actions to run
     * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
     * You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
     * Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24825: fix REST OpenAPI missing/pathless servers entry [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #26801:
URL: https://github.com/apache/camel/pull/26801#issuecomment-5811264709

   <!-- camel-backport-bot -->
   
   ### 🔄 Backport Bot
   
   **Port PRs created:**
   - ✅ `camel-4.22.x` → #26837
   
   â„šī¸ If you push additional commits after `/port`, use `/port` again to update the port PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24825: fix REST OpenAPI missing/pathless servers entry [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #26801:
URL: https://github.com/apache/camel/pull/26801#issuecomment-5795990185

   <!-- camel-backport-bot -->
   
   ### 🔄 Backport Bot
   
   This bugfix targets `main` and may need porting to:
   - `camel-4.22.x`
   
   Labels `port/<branch>` have been added. Remove a label to opt out of porting to that branch.
   
   Port PRs will be created automatically when this PR is merged. Comment `/port` to create them now.
   
   â„šī¸ If you push additional commits after `/port`, use `/port` again to update the port PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24825: fix REST OpenAPI missing/pathless servers entry [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26801:
URL: https://github.com/apache/camel/pull/26801#issuecomment-5797393792

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `components/camel-rest-openapi`
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 20 of 693 tested, 27 compile-only — current: 20 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **20 affected modules** (current approach: 20).
   
   **Skip-tests mode would test 20 modules** (1 direct + 19 downstream), **skip tests for 27** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (20)</summary>
   
   - `camel-a2a` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-jbang-mcp` ← downstream of org.apache.camel:camel-catalog
   - `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jbang-plugin-route-parser` ← downstream of org.apache.camel:camel-route-parser
   - `camel-jbang-plugin-tui` ← downstream of org.apache.camel:camel-catalog
   - `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jsonpath` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-knative-http` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
   - `camel-mcp-server` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-micrometer-prometheus` ← downstream of org.apache.camel:camel-platform-http-main
   - `camel-oauth` ← downstream of org.apache.camel:camel-platform-http-main
   - `camel-observability-services` ← downstream of org.apache.camel:camel-micrometer-prometheus
   - `camel-openai` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-openapi-validator` ← downstream of org.apache.camel:camel-rest-openapi
   - `camel-platform-http-main` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-platform-http-vertx` ← downstream of org.apache.camel:camel-rest-openapi
   - `camel-rest-openapi` ← components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java, components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiHelper.java, components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpointV3Test.java
   - `camel-yaml-dsl-validator` ← downstream of org.apache.camel:camel-catalog
   - `camel-yaml-dsl-validator-maven-plugin` ← downstream of org.apache.camel:camel-yaml-dsl-validator
   
   </details>
   
   <details><summary>Modules with tests skipped (27)</summary>
   
   - `apache-camel`
   - `camel-allcomponents`
   - `camel-catalog`
   - `camel-catalog-console`
   - `camel-catalog-maven`
   - `camel-catalog-suggest`
   - `camel-componentdsl`
   - `camel-endpointdsl`
   - `camel-endpointdsl-support`
   - `camel-itest`
   - `camel-jbang-core`
   - `camel-jbang-it`
   - `camel-jbang-main`
   - `camel-jbang-plugin-edit`
   - `camel-jbang-plugin-generate`
   - `camel-jbang-plugin-kubernetes`
   - `camel-jbang-plugin-test`
   - `camel-kamelet-main`
   - `camel-launcher`
   - `camel-report-maven-plugin`
   - `camel-route-parser`
   - `camel-yaml-dsl`
   - `camel-yaml-dsl-deserializers`
   - `camel-yaml-dsl-maven-plugin`
   - `coverage`
   - `docs`
   - `dummy-component`
   
   </details>
   
   > :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
   
   </details>
   
   <details><summary>All tested modules (47 modules, 9m 23s total)</summary>
   
   **Total reactor time:** 9m 23s
   
   | Module | Duration | Status |
   | --- | --- | --- |
   | Camel :: AI :: MCP Server | 52.8s | SUCCESS |
   | Camel :: Launcher | 52.0s | SUCCESS |
   | Camel :: AI :: OpenAI | 45.2s | SUCCESS |
   | Camel :: JBang :: MCP | 40.4s | SUCCESS |
   | Camel :: Knative HTTP | 32.7s | SUCCESS |
   | Camel :: JBang :: Plugin :: TUI | 32.2s | SUCCESS |
   | Camel :: Component DSL | 29.8s | SUCCESS |
   | Camel :: OAuth | 29.1s | SUCCESS |
   | Camel :: REST OpenApi | 23.0s | SUCCESS |
   | Camel :: Catalog :: Camel Catalog | 22.0s | SUCCESS |
   | Camel :: Platform HTTP :: Vert.x | 22.0s | SUCCESS |
   | Camel :: AI :: A2A | 19.9s | SUCCESS |
   | Camel :: YAML DSL | 15.7s | SUCCESS |
   | Camel :: JBang :: Plugin :: Kubernetes | 15.0s | SUCCESS |
   | Camel :: Docs | 14.3s | SUCCESS |
   | Camel :: Platform HTTP :: Main | 13.0s | SUCCESS |
   | Camel :: JSon Path | 12.8s | SUCCESS |
   | Camel :: OpenAPI :: Validator | 9.5s | SUCCESS |
   | Camel :: YAML DSL :: Validator | 9.2s | SUCCESS |
   | Camel :: Kamelet Main | 8.6s | SUCCESS |
   | Camel :: JBang :: Plugin :: Testing | 8.0s | SUCCESS |
   | Camel :: Catalog :: Camel Route Parser | 6.7s | SUCCESS |
   | Camel :: Catalog :: Camel Report Maven Plugin | 6.6s | SUCCESS |
   | Camel :: YAML DSL :: Deserializers | 6.5s | SUCCESS |
   | Camel :: JBang :: Plugin :: Validate | 4.8s | SUCCESS |
   | Camel :: All Components Sync point | 4.4s | SUCCESS |
   | Camel :: YAML DSL :: Validator Maven Plugin | 4.2s | SUCCESS |
   | Camel :: Catalog :: Suggest (deprecated) | 3.1s | SUCCESS |
   | Camel :: Catalog :: Maven | 2.6s | SUCCESS |
   | Camel :: YAML DSL :: Maven Plugins | 2.2s | SUCCESS |
   | Camel :: Micrometer :: Prometheus | 2.1s | SUCCESS |
   | Camel :: Coverage | 1.6s | SUCCESS |
   | Camel :: JBang :: Plugin :: Edit | 1.6s | SUCCESS |
   | Camel :: Assembly | 1.5s | SUCCESS |
   | Camel :: JBang :: Main | 1.1s | SUCCESS |
   | Camel :: JBang :: Plugin :: Generate | 1.0s | SUCCESS |
   | Camel :: JBang :: Integration tests | 1.0s | SUCCESS |
   | Camel :: Endpoint DSL :: Support | 0.9s | SUCCESS |
   | Camel :: Catalog :: Console | 0.8s | SUCCESS |
   | Camel :: Launcher :: Container | 0.7s | SUCCESS |
   | Camel :: Observability Services | 0.7s | SUCCESS |
   | Camel :: JBang :: Plugin :: MCP | 0.6s | SUCCESS |
   | Camel :: Catalog :: Dummy Component | 0.6s | SUCCESS |
   | Camel :: JBang :: Plugin :: Route Parser | 0.5s | SUCCESS |
   | Camel :: Endpoint DSL | n/a |  |
   | Camel :: Integration Tests | n/a |  |
   | Camel :: JBang :: Core | n/a |  |
   
   **Top 20 slowest modules:**
   - `Camel :: AI :: MCP Server` (52.8s)
   - `Camel :: Launcher` (52.0s)
   - `Camel :: AI :: OpenAI` (45.2s)
   - `Camel :: JBang :: MCP` (40.4s)
   - `Camel :: Knative HTTP` (32.7s)
   - `Camel :: JBang :: Plugin :: TUI` (32.2s)
   - `Camel :: Component DSL` (29.8s)
   - `Camel :: OAuth` (29.1s)
   - `Camel :: REST OpenApi` (23.0s)
   - `Camel :: Catalog :: Camel Catalog` (22.0s)
   - `Camel :: Platform HTTP :: Vert.x` (22.0s)
   - `Camel :: AI :: A2A` (19.9s)
   - `Camel :: YAML DSL` (15.7s)
   - `Camel :: JBang :: Plugin :: Kubernetes` (15.0s)
   - `Camel :: Docs` (14.3s)
   - `Camel :: Platform HTTP :: Main` (13.0s)
   - `Camel :: JSon Path` (12.8s)
   - `Camel :: OpenAPI :: Validator` (9.5s)
   - `Camel :: YAML DSL :: Validator` (9.2s)
   - `Camel :: Kamelet Main` (8.6s)
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/35869065553)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24825: fix REST OpenAPI missing/pathless servers entry [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #26801:
URL: https://github.com/apache/camel/pull/26801


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org