You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/12/15 11:00:22 UTC
(camel-k-examples) branch fix/openapi_configmap created (now 524d688)
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a change to branch fix/openapi_configmap
in repository https://gitbox.apache.org/repos/asf/camel-k-examples.git
at 524d688 fix: configmap is the only supported way
This branch includes the following new commits:
new 524d688 fix: configmap is the only supported way
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(camel-k-examples) 01/01: fix: configmap is the only supported way
Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch fix/openapi_configmap
in repository https://gitbox.apache.org/repos/asf/camel-k-examples.git
commit 524d688700109d32f7047ca35953047e5857627d
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Fri Dec 15 12:00:10 2023 +0100
fix: configmap is the only supported way
---
generic-examples/openapi/README.md | 3 ++-
generic-examples/openapi/greetings-api.json | 2 +-
generic-examples/openapi/greetings.groovy | 9 +++++----
generic-examples/openapi/petstore.groovy | 6 ++++--
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/generic-examples/openapi/README.md b/generic-examples/openapi/README.md
index 1b846a2..7e26b0c 100644
--- a/generic-examples/openapi/README.md
+++ b/generic-examples/openapi/README.md
@@ -7,7 +7,8 @@ Find useful examples about how to expose an Open API specification in a Camel K
Deploy the examples running
```
-kamel run --dev --name greetings --open-api file:greetings-api.json greetings.groovy
+kubectl create configmap my-openapi --from-file=greetings-api.json
+kamel run --dev --name greetings --open-api configmap:my-openapi greetings.groovy
```
Then you can test by calling the hello endpoint, ie:
diff --git a/generic-examples/openapi/greetings-api.json b/generic-examples/openapi/greetings-api.json
index 48e8f9e..1720506 100644
--- a/generic-examples/openapi/greetings-api.json
+++ b/generic-examples/openapi/greetings-api.json
@@ -5,7 +5,7 @@
"title" : "Greeting REST API"
},
"host" : "",
- "basePath" : "/camel/",
+ "basePath" : "/camel2/",
"tags" : [ {
"name" : "greetings",
"description" : "Greeting to {name}"
diff --git a/generic-examples/openapi/greetings.groovy b/generic-examples/openapi/greetings.groovy
index 90a09ce..a5c683a 100644
--- a/generic-examples/openapi/greetings.groovy
+++ b/generic-examples/openapi/greetings.groovy
@@ -17,10 +17,11 @@
*/
//
-// kamel run --dev --name greetings --open-api greetings-api.json greetings.groovy
-//
+// kubectl create configmap my-openapi --from-file=greetings-api.json
+// kamel run --dev --name greetings --open-api configmap:my-openapi greetings.groovy
+//
from('direct:greeting-api')
- .to('log:api?showAll=true&multiline=true')
+ .to('log:api?showAll=true&multiline=true')
.setBody()
- .simple('Hello from ${headers.name}')
+ .simple('Hello from ${headers.name} 2')
diff --git a/generic-examples/openapi/petstore.groovy b/generic-examples/openapi/petstore.groovy
index e5221e1..8f90173 100644
--- a/generic-examples/openapi/petstore.groovy
+++ b/generic-examples/openapi/petstore.groovy
@@ -16,9 +16,11 @@
* limitations under the License.
*/
+
+//
+// kubectl create configmap my-petstore-api --from-file=petstore-api.yaml
+// kamel run --dev --name petstore --open-api configmap:my-petstore-api petstore.groovy
//
-// kamel run --dev --name petstore --open-api file:petstore-api.yaml petstore.groovy
-//
from('direct:listPets')
.log('listPets')