You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zh...@apache.org on 2022/05/30 11:28:31 UTC

[camel-quarkus] branch main updated: Fix #3774 to add tests for openApi oneOf, allOf and anyOf with annotation @Schema (#3818)

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

zhfeng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new b9724fd06c Fix #3774 to add tests for openApi oneOf, allOf and anyOf with annotation @Schema (#3818)
b9724fd06c is described below

commit b9724fd06cb68b600597d42e0c339538434b31a5
Author: Amos Feng <zh...@gmail.com>
AuthorDate: Mon May 30 19:28:27 2022 +0800

    Fix #3774 to add tests for openApi oneOf, allOf and anyOf with annotation @Schema (#3818)
---
 .../java/deployment/OpenApiJavaProcessor.java      |  3 +
 .../component/openapijava/it/OpenApiRoutes.java    | 53 +++++++++++++++++
 .../component/openapijava/it/model/AllOfForm.java  | 49 ++++++++++++++++
 .../openapijava/it/model/AllOfFormWrapper.java     | 36 ++++++++++++
 .../component/openapijava/it/model/AnyOfForm.java  | 49 ++++++++++++++++
 .../openapijava/it/model/AnyOfFormWrapper.java     | 35 +++++++++++
 .../component/openapijava/it/model/OneOfForm.java  | 28 +++++++++
 .../openapijava/it/model/OneOfFormWrapper.java     | 54 +++++++++++++++++
 .../component/openapijava/it/model/XOfFormA.java   | 52 +++++++++++++++++
 .../component/openapijava/it/model/XOfFormB.java   | 52 +++++++++++++++++
 .../component/openapijava/it/v2/OpenApiV2Test.java |  2 +-
 .../component/openapijava/it/v3/OpenApiV3Test.java | 67 +++++++++++++++++++++-
 12 files changed, 478 insertions(+), 2 deletions(-)

diff --git a/extensions/openapi-java/deployment/src/main/java/org/apache/camel/quarkus/component/openapi/java/deployment/OpenApiJavaProcessor.java b/extensions/openapi-java/deployment/src/main/java/org/apache/camel/quarkus/component/openapi/java/deployment/OpenApiJavaProcessor.java
index 23cbe97c88..f927d7e9a6 100644
--- a/extensions/openapi-java/deployment/src/main/java/org/apache/camel/quarkus/component/openapi/java/deployment/OpenApiJavaProcessor.java
+++ b/extensions/openapi-java/deployment/src/main/java/org/apache/camel/quarkus/component/openapi/java/deployment/OpenApiJavaProcessor.java
@@ -46,6 +46,7 @@ import io.smallrye.openapi.api.util.MergeUtil;
 import io.smallrye.openapi.runtime.io.definition.DefinitionReader;
 import io.swagger.v3.oas.models.info.Contact;
 import io.swagger.v3.oas.models.info.Info;
+import io.swagger.v3.oas.models.media.Discriminator;
 import io.swagger.v3.oas.models.media.Schema;
 import org.apache.camel.CamelContext;
 import org.apache.camel.RoutesBuilder;
@@ -97,6 +98,8 @@ class OpenApiJavaProcessor {
         IndexView index = combinedIndex.getIndex();
         index.getAllKnownSubclasses(SCHEMA).stream().map(ClassInfo::toString).forEach(
                 name -> reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, name)));
+
+        reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false, Discriminator.class));
     }
 
     @BuildStep(onlyIf = ExposeOpenApiEnabled.class)
diff --git a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/OpenApiRoutes.java b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/OpenApiRoutes.java
index 6176af929e..20275a762c 100644
--- a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/OpenApiRoutes.java
+++ b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/OpenApiRoutes.java
@@ -25,8 +25,12 @@ import javax.ws.rs.core.MediaType;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.model.rest.CollectionFormat;
+import org.apache.camel.model.rest.RestBindingMode;
 import org.apache.camel.model.rest.RestParamType;
+import org.apache.camel.quarkus.component.openapijava.it.model.AllOfFormWrapper;
+import org.apache.camel.quarkus.component.openapijava.it.model.AnyOfFormWrapper;
 import org.apache.camel.quarkus.component.openapijava.it.model.Fruit;
+import org.apache.camel.quarkus.component.openapijava.it.model.OneOfFormWrapper;
 import org.eclipse.microprofile.config.inject.ConfigProperty;
 
 @ApplicationScoped
@@ -150,6 +154,52 @@ public class OpenApiRoutes extends RouteBuilder {
                     .securityDefinitions()
                     .openIdConnect("openId", "https://secure.apache.org/fake/openid-configuration")
                     .end();
+
+            rest("/form")
+                    .post("/oneOf")
+                    .tag("OneOf")
+                    .bindingMode(RestBindingMode.json)
+                    .description("OneOf rest service")
+
+                    .consumes("application/json")
+                    .produces("application/json")
+                    .type(OneOfFormWrapper.class)
+                    .responseMessage()
+                    .code(200).message("Ok")
+                    .endResponseMessage()
+
+                    .to("direct:res");
+
+            rest("/form")
+                    .post("/allOf")
+                    .tag("AllOf")
+                    .bindingMode(RestBindingMode.json)
+                    .description("AllOf rest service")
+
+                    .consumes("application/json")
+                    .produces("application/json")
+                    .type(AllOfFormWrapper.class)
+                    .responseMessage()
+                    .code(200).message("Ok")
+                    .endResponseMessage()
+
+                    .to("direct:res");
+
+            rest("/form")
+                    .post("/anyOf")
+                    .tag("AnyOf")
+                    .bindingMode(RestBindingMode.json)
+                    .description("AnyOf rest service")
+
+                    .consumes("application/json")
+                    .produces("application/json")
+                    .type(AnyOfFormWrapper.class)
+                    .responseMessage()
+                    .code(200).message("Ok")
+                    .endResponseMessage()
+
+                    .to("direct:res");
+
         }
 
         from("direct:fruits")
@@ -158,6 +208,9 @@ public class OpenApiRoutes extends RouteBuilder {
 
         from("direct:echoMethodPath")
                 .setBody().simple("${header.CamelHttpMethod}: ${header.CamelHttpPath}");
+
+        from("direct:res")
+                .setBody(constant("{\"result\": \"Ok\"}"));
     }
 
     private Set<Fruit> getFruits() {
diff --git a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AllOfForm.java b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AllOfForm.java
new file mode 100644
index 0000000000..75db58229c
--- /dev/null
+++ b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AllOfForm.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapijava.it.model;
+
+import com.fasterxml.jackson.annotation.JsonUnwrapped;
+import io.quarkus.runtime.annotations.RegisterForReflection;
+import io.swagger.v3.oas.annotations.media.Schema;
+
+// Combination of both classes flattened out
+@Schema(allOf = { XOfFormA.class, XOfFormB.class })
+@RegisterForReflection
+public class AllOfForm {
+    @JsonUnwrapped
+    XOfFormA formA;
+
+    @JsonUnwrapped
+    XOfFormB formB;
+
+    public XOfFormA getFormA() {
+        return this.formA;
+    }
+
+    public void setFormA(XOfFormA formA) {
+        this.formA = formA;
+    }
+
+    public XOfFormB getFormB() {
+        return this.formB;
+    }
+
+    public void setFormB(XOfFormB formB) {
+        this.formB = formB;
+    }
+
+}
diff --git a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AllOfFormWrapper.java b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AllOfFormWrapper.java
new file mode 100644
index 0000000000..1a4d758b28
--- /dev/null
+++ b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AllOfFormWrapper.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapijava.it.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
+public class AllOfFormWrapper {
+
+    @JsonProperty("fullForm")
+    AllOfForm fullForm;
+
+    public AllOfForm getFullForm() {
+        return this.fullForm;
+    }
+
+    public void setFullForm(AllOfForm fullForm) {
+        this.fullForm = fullForm;
+    }
+
+}
diff --git a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AnyOfForm.java b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AnyOfForm.java
new file mode 100644
index 0000000000..668290d9fa
--- /dev/null
+++ b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AnyOfForm.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapijava.it.model;
+
+import com.fasterxml.jackson.annotation.JsonUnwrapped;
+import io.quarkus.runtime.annotations.RegisterForReflection;
+import io.swagger.v3.oas.annotations.media.Schema;
+
+// Combination of both classes flattened out
+@RegisterForReflection
+@Schema(anyOf = { XOfFormA.class, XOfFormB.class })
+public class AnyOfForm {
+    @JsonUnwrapped
+    XOfFormA formA;
+
+    @JsonUnwrapped
+    XOfFormB formB;
+
+    public XOfFormA getFormA() {
+        return this.formA;
+    }
+
+    public void setFormA(XOfFormA formA) {
+        this.formA = formA;
+    }
+
+    public XOfFormB getFormB() {
+        return this.formB;
+    }
+
+    public void setFormB(XOfFormB formB) {
+        this.formB = formB;
+    }
+
+}
diff --git a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AnyOfFormWrapper.java b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AnyOfFormWrapper.java
new file mode 100644
index 0000000000..64059af720
--- /dev/null
+++ b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/AnyOfFormWrapper.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapijava.it.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
+public class AnyOfFormWrapper {
+
+    @JsonProperty("formElements")
+    AnyOfForm formPeices;
+
+    public AnyOfForm getFormPeices() {
+        return this.formPeices;
+    }
+
+    public void setFormPeices(AnyOfForm formPeices) {
+        this.formPeices = formPeices;
+    }
+}
diff --git a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/OneOfForm.java b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/OneOfForm.java
new file mode 100644
index 0000000000..ee6824d800
--- /dev/null
+++ b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/OneOfForm.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapijava.it.model;
+
+import io.swagger.v3.oas.annotations.media.DiscriminatorMapping;
+import io.swagger.v3.oas.annotations.media.Schema;
+
+@Schema(oneOf = { XOfFormA.class, XOfFormB.class }, discriminatorProperty = "code", discriminatorMapping = {
+        @DiscriminatorMapping(value = "a-123", schema = XOfFormA.class),
+        @DiscriminatorMapping(value = "b-456", schema = XOfFormB.class) })
+public interface OneOfForm {
+    // The discriminator explicitly declares which property you can inspect to determine the object type.
+    // The discriminator must apply to the same level of the schema it is declared in (common mistake when using nested objects).
+}
diff --git a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/OneOfFormWrapper.java b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/OneOfFormWrapper.java
new file mode 100644
index 0000000000..f4eafbfa7e
--- /dev/null
+++ b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/OneOfFormWrapper.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapijava.it.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
+public class OneOfFormWrapper {
+
+    @JsonProperty("formType")
+    String formType;
+
+    @JsonProperty("form")
+    @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "code")
+    @JsonSubTypes({
+            @Type(value = XOfFormA.class, name = "Form A"),
+            @Type(value = XOfFormB.class, name = "Form B")
+    })
+    OneOfForm form;
+
+    public String getFormType() {
+        return this.formType;
+    }
+
+    public void setFormType(String formType) {
+        this.formType = formType;
+    }
+
+    public OneOfForm getForm() {
+        return this.form;
+    }
+
+    public void setForm(OneOfForm form) {
+        this.form = form;
+    }
+}
diff --git a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/XOfFormA.java b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/XOfFormA.java
new file mode 100644
index 0000000000..91695931da
--- /dev/null
+++ b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/XOfFormA.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapijava.it.model;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
+public class XOfFormA implements OneOfForm {
+    String code = "a-1234";
+
+    String a;
+    int b;
+
+    public String getCode() {
+        return this.code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getA() {
+        return this.a;
+    }
+
+    public void setA(String a) {
+        this.a = a;
+    }
+
+    public int getB() {
+        return this.b;
+    }
+
+    public void setB(int b) {
+        this.b = b;
+    }
+
+}
diff --git a/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/XOfFormB.java b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/XOfFormB.java
new file mode 100644
index 0000000000..dccc1b1e47
--- /dev/null
+++ b/integration-tests/openapi-java/src/main/java/org/apache/camel/quarkus/component/openapijava/it/model/XOfFormB.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.openapijava.it.model;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
+public class XOfFormB implements OneOfForm {
+    String code = "b-456";
+
+    int x;
+    String y;
+
+    public String getCode() {
+        return this.code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public int getX() {
+        return this.x;
+    }
+
+    public void setX(int x) {
+        this.x = x;
+    }
+
+    public String getY() {
+        return this.y;
+    }
+
+    public void setY(String y) {
+        this.y = y;
+    }
+
+}
diff --git a/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/v2/OpenApiV2Test.java b/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/v2/OpenApiV2Test.java
index d59ac56944..69fdfe24ac 100644
--- a/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/v2/OpenApiV2Test.java
+++ b/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/v2/OpenApiV2Test.java
@@ -30,7 +30,7 @@ import static org.hamcrest.Matchers.hasKey;
 import static org.hamcrest.Matchers.is;
 
 /**
- * Tests specific to to OpenAPI 2.x
+ * Tests specific to OpenAPI 2.x
  */
 @QuarkusTest
 @TestProfile(OpenApiV2TestProfile.class)
diff --git a/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/v3/OpenApiV3Test.java b/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/v3/OpenApiV3Test.java
index 0f7159b0d3..552d57981f 100644
--- a/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/v3/OpenApiV3Test.java
+++ b/integration-tests/openapi-java/src/test/java/org/apache/camel/quarkus/component/openapijava/it/v3/OpenApiV3Test.java
@@ -29,7 +29,7 @@ import static org.hamcrest.Matchers.hasKey;
 import static org.hamcrest.Matchers.is;
 
 /**
- * Tests specific to to OpenAPI 3.x
+ * Tests specific to OpenAPI 3.x
  */
 @QuarkusTest
 @TestProfile(OpenApiV3TestProfile.class)
@@ -108,4 +108,69 @@ public class OpenApiV3Test extends OpenApiTest {
                         "components.schemas.Fruit.properties.description.type", is("string"),
                         "components.schemas.Fruit.properties.num.type", is("integer"));
     }
+
+    @ParameterizedTest
+    @EnumSource(OpenApiContentType.class)
+    public void openApiOneOf(OpenApiContentType contentType) {
+        RestAssured.given()
+                .header("Accept", contentType.getMimeType())
+                .get("/openapi")
+                .then()
+                .contentType(ContentType.JSON)
+                .statusCode(200)
+                .body(
+                        "components.schemas.XOfFormA.type", is("object"),
+                        "components.schemas.XOfFormA.properties.code.type", is("string"),
+                        "components.schemas.XOfFormA.properties.a.type", is("string"),
+                        "components.schemas.XOfFormA.properties.b.type", is("integer"),
+                        "components.schemas.XOfFormA.properties.b.format", is("int32"),
+
+                        "components.schemas.XOfFormB.type", is("object"),
+                        "components.schemas.XOfFormB.properties.code.type", is("string"),
+                        "components.schemas.XOfFormB.properties.x.type", is("integer"),
+                        "components.schemas.XOfFormB.properties.x.format", is("int32"),
+                        "components.schemas.XOfFormB.properties.y.type", is("string"),
+
+                        "components.schemas.OneOfForm.oneOf[0].$ref", is("#/components/schemas/XOfFormA"),
+                        "components.schemas.OneOfForm.oneOf[1].$ref", is("#/components/schemas/XOfFormB"),
+
+                        "components.schemas.OneOfFormWrapper.type", is("object"),
+                        "components.schemas.OneOfFormWrapper.properties.formType.type", is("string"),
+                        "components.schemas.OneOfFormWrapper.properties.form.$ref", is("#/components/schemas/OneOfForm"));
+    }
+
+    @ParameterizedTest
+    @EnumSource(OpenApiContentType.class)
+    public void openApiAllOf(OpenApiContentType contentType) {
+        RestAssured.given()
+                .header("Accept", contentType.getMimeType())
+                .get("/openapi")
+                .then()
+                .contentType(ContentType.JSON)
+                .statusCode(200)
+                .body(
+                        "components.schemas.AllOfForm.allOf[0].$ref", is("#/components/schemas/XOfFormA"),
+                        "components.schemas.AllOfForm.allOf[1].$ref", is("#/components/schemas/XOfFormB"),
+
+                        "components.schemas.AllOfFormWrapper.type", is("object"),
+                        "components.schemas.AllOfFormWrapper.properties.fullForm.$ref", is("#/components/schemas/AllOfForm"));
+    }
+
+    @ParameterizedTest
+    @EnumSource(OpenApiContentType.class)
+    public void openApiAnyOf(OpenApiContentType contentType) {
+        RestAssured.given()
+                .header("Accept", contentType.getMimeType())
+                .get("/openapi")
+                .then()
+                .contentType(ContentType.JSON)
+                .statusCode(200)
+                .body(
+                        "components.schemas.AnyOfForm.anyOf[0].$ref", is("#/components/schemas/XOfFormA"),
+                        "components.schemas.AnyOfForm.anyOf[1].$ref", is("#/components/schemas/XOfFormB"),
+
+                        "components.schemas.AnyOfFormWrapper.type", is("object"),
+                        "components.schemas.AnyOfFormWrapper.properties.formElements.$ref",
+                        is("#/components/schemas/AnyOfForm"));
+    }
 }