This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch camel-quarkus-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git
The following commit(s) were added to refs/heads/camel-quarkus-main by this
push:
new babac6f3 Add Swagger UI to openapi-contract-first example project
babac6f3 is described below
commit babac6f34ed6a7a3a42c1ad2c6898e032516674f
Author: James Netherton <[email protected]>
AuthorDate: Mon Jan 19 07:47:12 2026 +0000
Add Swagger UI to openapi-contract-first example project
---
openapi-contract-first/README.adoc | 4 +++-
openapi-contract-first/pom.xml | 4 ++++
.../java/org/acme/examples/openapi/contract/first/PetStoreRoute.java | 5 -----
openapi-contract-first/src/main/resources/application.properties | 2 ++
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/openapi-contract-first/README.adoc
b/openapi-contract-first/README.adoc
index fb3b950b..e7053d8e 100644
--- a/openapi-contract-first/README.adoc
+++ b/openapi-contract-first/README.adoc
@@ -31,7 +31,9 @@ workspace. Any modifications in your project will
automatically take effect in t
TIP: Please refer to the Development mode section of
https://camel.apache.org/camel-quarkus/latest/first-steps.html#_development_mode[Camel
Quarkus User guide] for more details.
-// TODO: Describe how the user should interact with the example here
+=== Swagger UI
+
+You can interact with the Petstore REST APIs with the Quarkus Swagger UI. Open
http://localhost:8080/q/swagger-ui in a web browser.
=== Package and run the application
diff --git a/openapi-contract-first/pom.xml b/openapi-contract-first/pom.xml
index dcf58c36..af00c4b2 100644
--- a/openapi-contract-first/pom.xml
+++ b/openapi-contract-first/pom.xml
@@ -82,6 +82,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-rest-openapi</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-openapi-java</artifactId>
+ </dependency>
<!-- Test -->
<dependency>
diff --git
a/openapi-contract-first/src/main/java/org/acme/examples/openapi/contract/first/PetStoreRoute.java
b/openapi-contract-first/src/main/java/org/acme/examples/openapi/contract/first/PetStoreRoute.java
index bc8270fe..5f9790a0 100644
---
a/openapi-contract-first/src/main/java/org/acme/examples/openapi/contract/first/PetStoreRoute.java
+++
b/openapi-contract-first/src/main/java/org/acme/examples/openapi/contract/first/PetStoreRoute.java
@@ -18,7 +18,6 @@ package org.acme.examples.openapi.contract.first;
import jakarta.enterprise.context.ApplicationScoped;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.rest.RestBindingMode;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import sample.petstore.model.Pet;
import sample.petstore.model.Pet.StatusEnum;
@@ -34,10 +33,6 @@ public class PetStoreRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
- // turn on json binding and scan for POJO classes in the model package
- restConfiguration().bindingMode(RestBindingMode.json)
- .bindingPackageScan("sample.petstore.model");
-
rest().openApi().specification("petstore.json").missingOperation("ignore");
from("direct:getPetById")
diff --git a/openapi-contract-first/src/main/resources/application.properties
b/openapi-contract-first/src/main/resources/application.properties
index 55bcfd59..51f75c9c 100644
--- a/openapi-contract-first/src/main/resources/application.properties
+++ b/openapi-contract-first/src/main/resources/application.properties
@@ -17,7 +17,9 @@
quarkus.native.resources.includes=petstore.json
quarkus.camel.openapi.codegen.model-package=sample.petstore.model
quarkus.camel.openapi.codegen.not-null-jackson=true
+
camel.rest.bindingMode=json
camel.rest.bindingPackageScan=${quarkus.camel.openapi.codegen.model-package}
+camel.rest.apiContextPath=/api-doc
pet.name=Tony the tiger