diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustComponentApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustComponentApp.java new file mode 100644 index 00000000..47a36311 --- /dev/null +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustComponentApp.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *
+ * Licensed 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.eclipse.microprofile.openapi.reader;
+
+import java.util.HashMap;
+
+import org.eclipse.microprofile.openapi.OASFactory;
+import org.eclipse.microprofile.openapi.OASModelReader;
+import org.eclipse.microprofile.openapi.models.Components;
+import org.eclipse.microprofile.openapi.models.OpenAPI;
+import org.eclipse.microprofile.openapi.models.info.Contact;
+import org.eclipse.microprofile.openapi.models.info.Info;
+import org.eclipse.microprofile.openapi.models.media.Schema;
+
+public class MyOASModelReaderForJustComponentApp implements OASModelReader {
+
+ @Override
+ public OpenAPI buildModel() {
+ return OASFactory.createObject(OpenAPI.class)
+ .info(OASFactory.createObject(Info.class)
+ .title("MarketApp API")
+ .version("1.0")
+ .termsOfService("http://example.com/terms")
+ .contact(OASFactory.createObject(Contact.class)
+ .name("market API Support")
+ .url("http://example.com/contact")
+ .email("admin@example.com")))
+ .components(OASFactory.createObject(Components.class)
+ .schemas(new HashMap
+ * Licensed 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.eclipse.microprofile.openapi.reader;
+
+import org.eclipse.microprofile.openapi.OASFactory;
+import org.eclipse.microprofile.openapi.OASModelReader;
+import org.eclipse.microprofile.openapi.models.OpenAPI;
+import org.eclipse.microprofile.openapi.models.info.Contact;
+import org.eclipse.microprofile.openapi.models.info.Info;
+
+public class MyOASModelReaderForJustWebHookApp implements OASModelReader {
+
+ @Override
+ public OpenAPI buildModel() {
+ return OASFactory.createObject(OpenAPI.class)
+ .info(OASFactory.createObject(Info.class)
+ .title("MarketApp API")
+ .version("1.0")
+ .termsOfService("http://example.com/terms")
+ .contact(OASFactory.createObject(Contact.class)
+ .name("market API Support")
+ .url("http://example.com/contact")
+ .email("admin@example.com")))
+ .addWebhook("MarketEvent", OASFactory.createPathItem()
+ .GET(OASFactory.createOperation()
+ .summary("Notifies that a deal has been done")
+ .responses(OASFactory.createAPIResponses()
+ .addAPIResponse("202", OASFactory.createAPIResponse()
+ .description(
+ "Indicates that the deal was processed successfully")))));
+ }
+}
diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustComponentTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustComponentTest.java
new file mode 100644
index 00000000..f9e94924
--- /dev/null
+++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustComponentTest.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
+ *
+ * Licensed 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.eclipse.microprofile.openapi.tck;
+
+import static org.hamcrest.Matchers.equalTo;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.testng.annotations.Test;
+
+import io.restassured.response.ValidatableResponse;
+
+public class ModelReaderAppWithJustComponentTest extends AppTestBase {
+ @Deployment(name = "airlinesModelReader", testable = false)
+ public static WebArchive createDeployment() {
+ return ShrinkWrap.create(WebArchive.class, "noPathsAppReader.war")
+ .addPackages(true, "org.eclipse.microprofile.openapi.reader")
+ .addAsManifestResource("microprofile-reader-just-component.properties",
+ "microprofile-config.properties");
+ }
+
+ @Test(dataProvider = "formatProvider")
+ public void testDocumentCreated(String type) {
+ ValidatableResponse vr = callEndpoint(type);
+ vr.body("components.schemas.id.format", equalTo("int32"));
+ }
+}
diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustWebHookTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustWebHookTest.java
new file mode 100644
index 00000000..a6ffbae4
--- /dev/null
+++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustWebHookTest.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
+ *
+ * Licensed 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.eclipse.microprofile.openapi.tck;
+
+import static org.hamcrest.Matchers.equalTo;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.testng.annotations.Test;
+
+import io.restassured.response.ValidatableResponse;
+
+public class ModelReaderAppWithJustWebHookTest extends AppTestBase {
+ @Deployment(name = "airlinesModelReader", testable = false)
+ public static WebArchive createDeployment() {
+ return ShrinkWrap.create(WebArchive.class, "noPathsAppReader.war")
+ .addPackages(true, "org.eclipse.microprofile.openapi.reader")
+ .addAsManifestResource("microprofile-reader-just-webhook.properties", "microprofile-config.properties");
+ }
+
+ @Test(dataProvider = "formatProvider")
+ public void testDocumentCreated(String type) {
+ ValidatableResponse vr = callEndpoint(type);
+ vr.body("webhooks.MarketEvent.get.summary", equalTo("Notifies that a deal has been done"));
+ }
+}
diff --git a/tck/src/main/resources/microprofile-reader-just-component.properties b/tck/src/main/resources/microprofile-reader-just-component.properties
new file mode 100644
index 00000000..fd002ba1
--- /dev/null
+++ b/tck/src/main/resources/microprofile-reader-just-component.properties
@@ -0,0 +1,14 @@
+# Copyright (c) 2024 Contributors to the Eclipse Foundation
+#
+# Licensed 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.
+mp.openapi.model.reader=org.eclipse.microprofile.openapi.reader.MyOASModelReaderForJustComponentApp
\ No newline at end of file
diff --git a/tck/src/main/resources/microprofile-reader-just-webhook.properties b/tck/src/main/resources/microprofile-reader-just-webhook.properties
new file mode 100644
index 00000000..2b76a801
--- /dev/null
+++ b/tck/src/main/resources/microprofile-reader-just-webhook.properties
@@ -0,0 +1,14 @@
+# Copyright (c) 2024 Contributors to the Eclipse Foundation
+#
+# Licensed 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.
+mp.openapi.model.reader=org.eclipse.microprofile.openapi.reader.MyOASModelReaderForJustWebHookApp
\ No newline at end of file