From 265c21af62a3f726c522ec5253ee1f9553ccf68d Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Thu, 25 Apr 2024 21:08:59 +0100 Subject: [PATCH] test summary on Info annotation --- .../openapi/runtime/scanner/ConfigExtensionsTest.java | 4 +++- .../runtime/scanner/resource.testAllInfoViaConfig.json | 3 ++- .../openapi/gradleplugin/SmallryeOpenApiPluginTest.java | 3 +++ .../test/java/io/smallrye/openapi/mavenplugin/BasicIT.java | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/extension-jaxrs/src/test/java/io/smallrye/openapi/runtime/scanner/ConfigExtensionsTest.java b/extension-jaxrs/src/test/java/io/smallrye/openapi/runtime/scanner/ConfigExtensionsTest.java index 1d6a89670..a6879f5dd 100644 --- a/extension-jaxrs/src/test/java/io/smallrye/openapi/runtime/scanner/ConfigExtensionsTest.java +++ b/extension-jaxrs/src/test/java/io/smallrye/openapi/runtime/scanner/ConfigExtensionsTest.java @@ -25,6 +25,7 @@ class ConfigExtensionsTest extends JaxRsDataObjectScannerTestBase { private static final String TITLE = "mp.openapi.extensions.smallrye.info.title"; private static final String VERSION = "mp.openapi.extensions.smallrye.info.version"; private static final String DESCRIPTION = "mp.openapi.extensions.smallrye.info.description"; + private static final String SUMMARY = "mp.openapi.extensions.smallrye.info.summary"; private static final String TERMS = "mp.openapi.extensions.smallrye.info.termsOfService"; private static final String CONTACT_EMAIL = "mp.openapi.extensions.smallrye.info.contact.email"; private static final String CONTACT_NAME = "mp.openapi.extensions.smallrye.info.contact.name"; @@ -85,10 +86,10 @@ void testSettingJustLicenseName() throws IOException, JSONException { @Test void testSettingAllInfo() throws IOException, JSONException { - System.setProperty(TITLE, "My own awesome REST service"); System.setProperty(VERSION, "1.2.3"); System.setProperty(DESCRIPTION, "This service is awesome"); + System.setProperty(SUMMARY, "This summary is rather boring"); System.setProperty(TERMS, "The terms is also awesome"); System.setProperty(CONTACT_EMAIL, "phillip.kruger@redhat.com"); System.setProperty(CONTACT_NAME, "Phillip Kruger"); @@ -109,6 +110,7 @@ void testSettingAllInfo() throws IOException, JSONException { System.clearProperty(TITLE); System.clearProperty(VERSION); System.clearProperty(DESCRIPTION); + System.clearProperty(SUMMARY); System.clearProperty(TERMS); System.clearProperty(CONTACT_EMAIL); System.clearProperty(CONTACT_NAME); diff --git a/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/scanner/resource.testAllInfoViaConfig.json b/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/scanner/resource.testAllInfoViaConfig.json index 04fd758f6..f81e58686 100644 --- a/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/scanner/resource.testAllInfoViaConfig.json +++ b/extension-jaxrs/src/test/resources/io/smallrye/openapi/runtime/scanner/resource.testAllInfoViaConfig.json @@ -4,6 +4,7 @@ "title" : "My own awesome REST service", "description" : "This service is awesome", "termsOfService" : "The terms is also awesome", + "summary" : "This summary is rather boring", "contact" : { "name" : "Phillip Kruger", "url" : "https://www.phillip-kruger.com", @@ -182,4 +183,4 @@ } } } -} \ No newline at end of file +} diff --git a/tools/gradle-plugin/src/test/java/io/smallrye/openapi/gradleplugin/SmallryeOpenApiPluginTest.java b/tools/gradle-plugin/src/test/java/io/smallrye/openapi/gradleplugin/SmallryeOpenApiPluginTest.java index 2d992dd5d..a35b79b66 100644 --- a/tools/gradle-plugin/src/test/java/io/smallrye/openapi/gradleplugin/SmallryeOpenApiPluginTest.java +++ b/tools/gradle-plugin/src/test/java/io/smallrye/openapi/gradleplugin/SmallryeOpenApiPluginTest.java @@ -82,6 +82,7 @@ void taskPropertiesInheritance() { ext.infoLicenseUrl.set("info-license-url"); ext.infoTermsOfService.set("info-tos"); ext.infoTitle.set("info-title"); + ext.infoSummary.set("info-summary"); ext.infoVersion.set("info-version"); ext.modelReader.set("model-reader"); ext.operationIdStrategy.set(OperationIdStrategy.CLASS_METHOD); @@ -112,6 +113,7 @@ void taskPropertiesInheritance() { SmallryeOpenApiProperties::getInfoDescription, SmallryeOpenApiProperties::getInfoLicenseName, SmallryeOpenApiProperties::getInfoLicenseUrl, + SmallryeOpenApiProperties::getInfoSummary, SmallryeOpenApiProperties::getInfoTermsOfService, SmallryeOpenApiProperties::getInfoTitle, SmallryeOpenApiProperties::getInfoVersion, @@ -199,6 +201,7 @@ void smokeProject(Path buildDir, boolean withQuarkus, String taskName, String ou " infoVersion.set(\"Info Version\")", " infoDescription.set(\"Info Description\")", " infoTermsOfService.set(\"Info TOS\")", + " infoSummary.set(\"Info Summary\")", " infoContactEmail.set(\"Info Email\")", " infoContactName.set(\"Info Contact\")", " infoContactUrl.set(\"https://github.com/smallrye/smallrye-open-api/issues/1231\")", diff --git a/tools/maven-plugin/src/test/java/io/smallrye/openapi/mavenplugin/BasicIT.java b/tools/maven-plugin/src/test/java/io/smallrye/openapi/mavenplugin/BasicIT.java index 6f332a1b9..d27b23885 100644 --- a/tools/maven-plugin/src/test/java/io/smallrye/openapi/mavenplugin/BasicIT.java +++ b/tools/maven-plugin/src/test/java/io/smallrye/openapi/mavenplugin/BasicIT.java @@ -39,6 +39,7 @@ void basic_info(MavenExecutionResult result) throws IOException { assertEquals(properties.get("infoTitle"), schema.getInfo().getTitle()); assertEquals(properties.get("infoDescription"), schema.getInfo().getDescription()); assertEquals(properties.get("infoTermsOfService"), schema.getInfo().getTermsOfService()); + assertEquals(properties.get("infoSummary"), schema.getInfo().getSummary()); assertEquals(properties.get("infoContactName"), schema.getInfo().getContact().getName()); assertEquals(properties.get("infoContactUrl"), schema.getInfo().getContact().getUrl()); assertEquals(properties.get("infoContactEmail"), schema.getInfo().getContact().getEmail());