This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new 0337a28  CAMEL-22116: Fix camel-openapi-validator to better support 
base-path such as SB war apps that are seperated by context-path
0337a28 is described below

commit 0337a2825912082265e55bc5a4a92b5ad39f7ac4
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Tue Jun 3 15:13:40 2025 +0200

    CAMEL-22116: Fix camel-openapi-validator to better support base-path such 
as SB war apps that are seperated by context-path
---
 openapi-contract-first/readme.adoc                               | 7 +++++--
 openapi-contract-first/src/main/resources/application.properties | 4 +++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/openapi-contract-first/readme.adoc 
b/openapi-contract-first/readme.adoc
index bf1cf0a..70750c8 100644
--- a/openapi-contract-first/readme.adoc
+++ b/openapi-contract-first/readme.adoc
@@ -12,6 +12,9 @@ The example uses the Petstore OpenAPI example which comes 
with 18 APIs. This exa
 implemented 2 of these APIs, and to ignore the remaining APIs. This is handy 
during development,
 so you can implement the APIs one by one.
 
+In the `application.properties` we have configured context-path and base-path 
for the Rest DSL service
+which allows us to control this from the properties file, instead of hardcoded 
values in the spec file (petstore.json).
+
 === How to run
 
 You can run this example using
@@ -23,7 +26,7 @@ You can run this example using
 You can call the Rest APIs such as
 
 ----
-curl http://0.0.0.0:8080/api/v3/pet/123
+curl http://0.0.0.0:8080/myapp/myapi/pet/123
 ----
 
 Which returns information about a pet.
@@ -31,7 +34,7 @@ Which returns information about a pet.
 You can also update an existing PET such:
 
 ----
-curl -XPUT -H "Content-Type: application/json" --data "@daisy.json" 
http://0.0.0.0:8080/api/v3/pet
+curl -XPUT -H "Content-Type: application/json" --data "@daisy.json" 
http://0.0.0.0:8080/myapp/myapi/pet
 ----
 
 
diff --git a/openapi-contract-first/src/main/resources/application.properties 
b/openapi-contract-first/src/main/resources/application.properties
index 6a8b365..57040a8 100644
--- a/openapi-contract-first/src/main/resources/application.properties
+++ b/openapi-contract-first/src/main/resources/application.properties
@@ -22,7 +22,9 @@ camel.main.name = CamelPetStore
 petName = Tony the tiger
 
 # to use a special context-path with spring boot
-# server.servlet.context-path = /myapp
+server.servlet.context-path: /myapp
+# and we can also define what the base-path should be instead of what's inside 
the petstore.json
+camel.component.rest-openapi.base-path = /myapi
 
 # to configure logging levels
 #logging.level.org.springframework = INFO

Reply via email to