From a9d6a95417dde3c08627f96443990259c9ab1fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Enrique=20Garc=C3=ADa=20Maci=C3=B1eiras?= Date: Tue, 8 Aug 2023 08:55:39 +0200 Subject: [PATCH] #251 Fix Parameter without description --- multiapi-engine/pom.xml | 2 +- .../resources/templates/openapi/template.ftlh | 12 ++--- .../plugin/openapi/OpenApiGeneratorTest.java | 6 ++- .../assets/TestApi.java | 12 ++--- .../assets/TestApi.java | 12 ++--- .../assets/TestApi.java | 12 ++--- .../testAnyOfInResponse/assets/GamesApi.java | 12 ++--- .../assets/TestApi.java | 14 +++--- .../assets/TestSchemaApi.java | 14 +++--- .../assets/TestTagFirstApi.java | 14 +++--- .../assets/TestTagSecondApi.java | 14 +++--- .../assets/TestApi.java | 10 ++-- .../assets/SchemaMasterApi.java | 28 +++++------ .../assets/SchemaMasterApi.java | 28 +++++------ .../testCreateDTO/assets/TestApi.java | 12 ++--- .../testDateTime/assets/TestApi.java | 10 ++-- .../testDateTimeOffset/assets/TestApi.java | 10 ++-- .../testDateTimeZoned/assets/TestApi.java | 10 ++-- .../assets/TestApi.java | 12 ++--- .../assets/RuleApi.java | 48 +++++++++--------- .../assets/RulesApi.java | 28 +++++------ .../testListString/assets/TestApi.java | 10 ++-- .../testListString/assets/TestInlineApi.java | 10 ++-- .../assets/TestApi.java | 12 ++--- .../testOneOfInResponse/assets/GamesApi.java | 12 ++--- .../testQueryParam/assets/TestApi.java | 10 ++-- .../testReferenceFile/assets/TestApi.java | 10 ++-- .../assets/SchemaMasterApi.java | 28 +++++------ scs-multiapi-gradle-plugin/build.gradle | 4 +- scs-multiapi-maven-plugin/pom.xml | 4 +- .../assets/TestApi.java | 50 +++++++++---------- .../assets/TestApi.java | 50 +++++++++---------- .../assets/TestFirstApi.java | 28 +++++------ .../assets/TestSecondApi.java | 28 +++++------ 34 files changed, 289 insertions(+), 287 deletions(-) diff --git a/multiapi-engine/pom.xml b/multiapi-engine/pom.xml index 636fe427..9e58d4b7 100644 --- a/multiapi-engine/pom.xml +++ b/multiapi-engine/pom.xml @@ -4,7 +4,7 @@ com.sngular multiapi-engine - 4.9.6 + 4.9.7 jar diff --git a/multiapi-engine/src/main/resources/templates/openapi/template.ftlh b/multiapi-engine/src/main/resources/templates/openapi/template.ftlh index 573fdd1d..39df7b10 100644 --- a/multiapi-engine/src/main/resources/templates/openapi/template.ftlh +++ b/multiapi-engine/src/main/resources/templates/openapi/template.ftlh @@ -70,13 +70,13 @@ public interface ${className?cap_first}Api { */ @Operation( - operationId = "${operation.operationId}",<#if operation.summary?has_content> - summary = "${operation.summary}", - tags = {<#list operation.tags as tag>"${tag}"}<#if operation.responseObjects?has_content>, - responses = { -<#list operation.responseObjects as response> @ApiResponse(responseCode = "${response.responseName}", description = "${response.description}"<#if response.contentObjects?has_content>, content = @Content(<#list response.contentObjects as content>mediaType = "${content.name}", schema = @Schema(implementation = ${content.dataType?api.getClassString()})))<#if !response?is_last>, + operationId = "${operation.operationId}",<#if operation.summary?has_content> + summary = "${operation.summary}", + tags = {<#list operation.tags as tag>"${tag}"}<#if operation.responseObjects?has_content>, + responses = { +<#list operation.responseObjects as response> @ApiResponse(responseCode = "${response.responseName}", description = "${response.description}"<#if response.contentObjects?has_content>, content = @Content(<#list response.contentObjects as content>mediaType = "${content.name}", schema = @Schema(implementation = ${content.dataType?api.getClassString()})))<#if !response?is_last>, - } + } ) @RequestMapping( method = RequestMethod.${operation.operationType}, diff --git a/multiapi-engine/src/test/java/com/sngular/api/generator/plugin/openapi/OpenApiGeneratorTest.java b/multiapi-engine/src/test/java/com/sngular/api/generator/plugin/openapi/OpenApiGeneratorTest.java index 1e71c069..af6a174d 100644 --- a/multiapi-engine/src/test/java/com/sngular/api/generator/plugin/openapi/OpenApiGeneratorTest.java +++ b/multiapi-engine/src/test/java/com/sngular/api/generator/plugin/openapi/OpenApiGeneratorTest.java @@ -14,18 +14,19 @@ import com.sngular.api.generator.plugin.exception.InvalidAPIException; import com.sngular.api.generator.plugin.openapi.parameter.SpecFile; +import lombok.extern.slf4j.Slf4j; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.CleanupMode; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +@Slf4j class OpenApiGeneratorTest { - @TempDir(cleanup = CleanupMode.NEVER) + @TempDir static Path baseDir; private static OpenApiGenerator openApiGenerator; @@ -109,6 +110,7 @@ static Stream fileSpecToProcess() { @MethodSource("fileSpecToProcess") void processFileSpec(final String type, final List specFileList, final Function validation) { openApiGenerator.processFileSpec(specFileList); + log.debug(baseDir.toAbsolutePath().toString()); Assertions.assertThat(validation.apply(baseDir)).isTrue(); } diff --git a/multiapi-engine/src/test/resources/openapigenerator/testAdditionalProperties/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testAdditionalProperties/assets/TestApi.java index 697af405..4a69ac20 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testAdditionalProperties/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testAdditionalProperties/assets/TestApi.java @@ -26,12 +26,12 @@ public interface TestApi { */ @Operation( - operationId = "testAdditionalProperties", - summary = "testAdditionalProperties", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "An object with additional properties", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))) - } + operationId = "testAdditionalProperties", + summary = "testAdditionalProperties", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "An object with additional properties", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testAdditionalPropertiesWithSchema/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testAdditionalPropertiesWithSchema/assets/TestApi.java index 81126cd2..445cac71 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testAdditionalPropertiesWithSchema/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testAdditionalPropertiesWithSchema/assets/TestApi.java @@ -26,12 +26,12 @@ public interface TestApi { */ @Operation( - operationId = "testAdditionalProperties", - summary = "testAdditionalProperties", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "An object with additional properties", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))) - } + operationId = "testAdditionalProperties", + summary = "testAdditionalProperties", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "An object with additional properties", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testAdditionalPropertiesWithUnnamedObject/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testAdditionalPropertiesWithUnnamedObject/assets/TestApi.java index a1a8fdea..a02b6b8d 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testAdditionalPropertiesWithUnnamedObject/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testAdditionalPropertiesWithUnnamedObject/assets/TestApi.java @@ -26,12 +26,12 @@ public interface TestApi { */ @Operation( - operationId = "testAdditionalProperties", - summary = "testAdditionalProperties", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "An object with additional properties", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))) - } + operationId = "testAdditionalProperties", + summary = "testAdditionalProperties", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "An object with additional properties", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testAnyOfInResponse/assets/GamesApi.java b/multiapi-engine/src/test/resources/openapigenerator/testAnyOfInResponse/assets/GamesApi.java index 401c7ebc..14e27848 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testAnyOfInResponse/assets/GamesApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testAnyOfInResponse/assets/GamesApi.java @@ -26,12 +26,12 @@ public interface GamesApi { */ @Operation( - operationId = "listGames", - summary = "List all available games", - tags = {"games"}, - responses = { - @ApiResponse(responseCode = "200", description = "A paged array of games", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InlineResponse200ListGamesAnyOfDTO.class))) - } + operationId = "listGames", + summary = "List all available games", + tags = {"games"}, + responses = { + @ApiResponse(responseCode = "200", description = "A paged array of games", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InlineResponse200ListGamesAnyOfDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testApiPathWithSpecialCharGeneration/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testApiPathWithSpecialCharGeneration/assets/TestApi.java index b9af0586..a3be3a32 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testApiPathWithSpecialCharGeneration/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testApiPathWithSpecialCharGeneration/assets/TestApi.java @@ -28,13 +28,13 @@ public interface TestApi { */ @Operation( - operationId = "showTestById", - summary = "Info for a specific test", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestInfoDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) - } + operationId = "showTestById", + summary = "Info for a specific test", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestInfoDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testApiPathWithSpecialCharGeneration/assets/TestSchemaApi.java b/multiapi-engine/src/test/resources/openapigenerator/testApiPathWithSpecialCharGeneration/assets/TestSchemaApi.java index 24a12663..01bbc74d 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testApiPathWithSpecialCharGeneration/assets/TestSchemaApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testApiPathWithSpecialCharGeneration/assets/TestSchemaApi.java @@ -27,13 +27,13 @@ public interface TestSchemaApi { */ @Operation( - operationId = "listTest", - summary = "List all available test", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) - } + operationId = "listTest", + summary = "List all available test", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testApiTagsGeneration/assets/TestTagFirstApi.java b/multiapi-engine/src/test/resources/openapigenerator/testApiTagsGeneration/assets/TestTagFirstApi.java index 741d94b2..581dd588 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testApiTagsGeneration/assets/TestTagFirstApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testApiTagsGeneration/assets/TestTagFirstApi.java @@ -27,13 +27,13 @@ public interface TestTagFirstApi { */ @Operation( - operationId = "listTestServer", - summary = "List all available testServer", - tags = {"TestTagFirst"}, - responses = { - @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))) - } + operationId = "listTestServer", + summary = "List all available testServer", + tags = {"TestTagFirst"}, + responses = { + @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testApiTagsGeneration/assets/TestTagSecondApi.java b/multiapi-engine/src/test/resources/openapigenerator/testApiTagsGeneration/assets/TestTagSecondApi.java index 84fed12e..5ffba030 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testApiTagsGeneration/assets/TestTagSecondApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testApiTagsGeneration/assets/TestTagSecondApi.java @@ -28,13 +28,13 @@ public interface TestTagSecondApi { */ @Operation( - operationId = "showTestById", - summary = "Info for a specific test", - tags = {"TestTagSecond"}, - responses = { - @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestInfoDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))) - } + operationId = "showTestById", + summary = "Info for a specific test", + tags = {"TestTagSecond"}, + responses = { + @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestInfoDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testApiWithNoComponents/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testApiWithNoComponents/assets/TestApi.java index 9c8a85af..e14c784a 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testApiWithNoComponents/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testApiWithNoComponents/assets/TestApi.java @@ -25,11 +25,11 @@ public interface TestApi { */ @Operation( - operationId = "testNoComponents", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "A string", content = @Content(mediaType = "application/json", schema = @Schema(implementation = String.class))) - } + operationId = "testNoComponents", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "A string", content = @Content(mediaType = "application/json", schema = @Schema(implementation = String.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testCoconutSchema/assets/SchemaMasterApi.java b/multiapi-engine/src/test/resources/openapigenerator/testCoconutSchema/assets/SchemaMasterApi.java index 8ec40a57..634f34ed 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testCoconutSchema/assets/SchemaMasterApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testCoconutSchema/assets/SchemaMasterApi.java @@ -27,13 +27,13 @@ public interface SchemaMasterApi { */ @Operation( - operationId = "getSchemaMaster", - tags = {"schemas"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = SchemaDTO.class))), - @ApiResponse(responseCode = "400", description = "Bad Request"), - @ApiResponse(responseCode = "500", description = "Server Error") - } + operationId = "getSchemaMaster", + tags = {"schemas"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = SchemaDTO.class))), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "500", description = "Server Error") + } ) @RequestMapping( method = RequestMethod.GET, @@ -52,13 +52,13 @@ default ResponseEntity getSchemaMaster(@Parameter(name = "subject", d */ @Operation( - operationId = "createSchemaMaster", - tags = {"schemas"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = SchemaDTO.class))), - @ApiResponse(responseCode = "400", description = "Bad Request"), - @ApiResponse(responseCode = "500", description = "Server Error") - } + operationId = "createSchemaMaster", + tags = {"schemas"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = SchemaDTO.class))), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "500", description = "Server Error") + } ) @RequestMapping( method = RequestMethod.POST, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testComplexAnyOf/assets/SchemaMasterApi.java b/multiapi-engine/src/test/resources/openapigenerator/testComplexAnyOf/assets/SchemaMasterApi.java index e83c3773..2e0e4795 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testComplexAnyOf/assets/SchemaMasterApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testComplexAnyOf/assets/SchemaMasterApi.java @@ -27,13 +27,13 @@ public interface SchemaMasterApi { */ @Operation( - operationId = "getSchemaMaster", - tags = {"schemas"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiSchemaDTO.class))), - @ApiResponse(responseCode = "400", description = "Bad Request"), - @ApiResponse(responseCode = "500", description = "Server Error") - } + operationId = "getSchemaMaster", + tags = {"schemas"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiSchemaDTO.class))), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "500", description = "Server Error") + } ) @RequestMapping( method = RequestMethod.GET, @@ -52,13 +52,13 @@ default ResponseEntity getSchemaMaster(@Parameter(name = "subject" */ @Operation( - operationId = "createSchemaMaster", - tags = {"schemas"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiSchemaDTO.class))), - @ApiResponse(responseCode = "400", description = "Bad Request"), - @ApiResponse(responseCode = "500", description = "Server Error") - } + operationId = "createSchemaMaster", + tags = {"schemas"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiSchemaDTO.class))), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "500", description = "Server Error") + } ) @RequestMapping( method = RequestMethod.POST, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testCreateDTO/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testCreateDTO/assets/TestApi.java index 50c6f18d..494234cb 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testCreateDTO/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testCreateDTO/assets/TestApi.java @@ -26,12 +26,12 @@ public interface TestApi { */ @Operation( - operationId = "testCreateDTO", - summary = "testCreateDTO", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "An object with additional properties", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))) - } + operationId = "testCreateDTO", + summary = "testCreateDTO", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "An object with additional properties", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testDateTime/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testDateTime/assets/TestApi.java index f2947d50..2777d382 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testDateTime/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testDateTime/assets/TestApi.java @@ -26,11 +26,11 @@ public interface TestApi { */ @Operation( - operationId = "testDateTime", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "An object with date and date-time formats", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDateDTO.class))) - } + operationId = "testDateTime", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "An object with date and date-time formats", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDateDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testDateTimeOffset/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testDateTimeOffset/assets/TestApi.java index 0f6be5a4..f47e4aab 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testDateTimeOffset/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testDateTimeOffset/assets/TestApi.java @@ -26,11 +26,11 @@ public interface TestApi { */ @Operation( - operationId = "testDateTime", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "An object with date and date-time formats", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDateDTO.class))) - } + operationId = "testDateTime", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "An object with date and date-time formats", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDateDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testDateTimeZoned/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testDateTimeZoned/assets/TestApi.java index a036423d..2e872bfe 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testDateTimeZoned/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testDateTimeZoned/assets/TestApi.java @@ -26,11 +26,11 @@ public interface TestApi { */ @Operation( - operationId = "testDateTime", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "An object with date and date-time formats", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDateDTO.class))) - } + operationId = "testDateTime", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "An object with date and date-time formats", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDateDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testExternalRefsGeneration/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testExternalRefsGeneration/assets/TestApi.java index 524e815c..c34b6ab7 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testExternalRefsGeneration/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testExternalRefsGeneration/assets/TestApi.java @@ -26,12 +26,12 @@ public interface TestApi { */ @Operation( - operationId = "listTest", - summary = "List all available test", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))) - } + operationId = "listTest", + summary = "List all available test", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testInlineSchemaCreation/assets/RuleApi.java b/multiapi-engine/src/test/resources/openapigenerator/testInlineSchemaCreation/assets/RuleApi.java index de58d8a3..6a126e98 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testInlineSchemaCreation/assets/RuleApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testInlineSchemaCreation/assets/RuleApi.java @@ -28,14 +28,14 @@ public interface RuleApi { */ @Operation( - operationId = "updateRule", - tags = {"rules"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = String.class))), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), - @ApiResponse(responseCode = "default", description = "Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) - } + operationId = "updateRule", + tags = {"rules"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = String.class))), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), + @ApiResponse(responseCode = "default", description = "Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.PUT, @@ -53,14 +53,14 @@ default ResponseEntity updateRule(@Parameter(name = "ruleId", descriptio */ @Operation( - operationId = "getSpecificRule", - tags = {"rules"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))), - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), - @ApiResponse(responseCode = "default", description = "Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) - } + operationId = "getSpecificRule", + tags = {"rules"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), + @ApiResponse(responseCode = "default", description = "Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, @@ -78,14 +78,14 @@ default ResponseEntity getSpecificRule(@Parameter(name = "ruleId", d */ @Operation( - operationId = "deleteRule", - tags = {"rules"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = String.class))), - @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), - @ApiResponse(responseCode = "default", description = "Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) - } + operationId = "deleteRule", + tags = {"rules"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = String.class))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), + @ApiResponse(responseCode = "default", description = "Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.DELETE, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testInlineSchemaCreation/assets/RulesApi.java b/multiapi-engine/src/test/resources/openapigenerator/testInlineSchemaCreation/assets/RulesApi.java index 04855a71..b174c0a8 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testInlineSchemaCreation/assets/RulesApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testInlineSchemaCreation/assets/RulesApi.java @@ -27,13 +27,13 @@ public interface RulesApi { */ @Operation( - operationId = "getAllRules", - tags = {"rules"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = List.class))), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), - @ApiResponse(responseCode = "default", description = "Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) - } + operationId = "getAllRules", + tags = {"rules"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = List.class))), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), + @ApiResponse(responseCode = "default", description = "Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, @@ -51,13 +51,13 @@ default ResponseEntity> getAllRules() { */ @Operation( - operationId = "createRule", - tags = {"rules"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), - @ApiResponse(responseCode = "default", description = "Error", content = @Content(mediaType = "text/plain", schema = @Schema(implementation = String.class))) - } + operationId = "createRule", + tags = {"rules"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))), + @ApiResponse(responseCode = "default", description = "Error", content = @Content(mediaType = "text/plain", schema = @Schema(implementation = String.class))) + } ) @RequestMapping( method = RequestMethod.POST, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testListString/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testListString/assets/TestApi.java index 6bae924b..4da9a156 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testListString/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testListString/assets/TestApi.java @@ -25,11 +25,11 @@ public interface TestApi { */ @Operation( - operationId = "testListString", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "An object with a list of strings", content = @Content(mediaType = "application/json", schema = @Schema(implementation = List.class))) - } + operationId = "testListString", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "An object with a list of strings", content = @Content(mediaType = "application/json", schema = @Schema(implementation = List.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testListString/assets/TestInlineApi.java b/multiapi-engine/src/test/resources/openapigenerator/testListString/assets/TestInlineApi.java index 92d9773d..062f8b87 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testListString/assets/TestInlineApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testListString/assets/TestInlineApi.java @@ -25,11 +25,11 @@ public interface TestInlineApi { */ @Operation( - operationId = "testListStringInline", - tags = {"test-inline"}, - responses = { - @ApiResponse(responseCode = "200", description = "A list of strings", content = @Content(mediaType = "application/json", schema = @Schema(implementation = List.class))) - } + operationId = "testListStringInline", + tags = {"test-inline"}, + responses = { + @ApiResponse(responseCode = "200", description = "A list of strings", content = @Content(mediaType = "application/json", schema = @Schema(implementation = List.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/TestApi.java index 616b3ded..962d950b 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/TestApi.java @@ -26,12 +26,12 @@ public interface TestApi { */ @Operation( - operationId = "createGame", - summary = "Start a Game", - tags = {"games"}, - responses = { - @ApiResponse(responseCode = "200", description = "Test File for SCC MultiApi Plugin.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InlineResponse200CreateGameDTO.class))) - } + operationId = "createGame", + summary = "Start a Game", + tags = {"games"}, + responses = { + @ApiResponse(responseCode = "200", description = "Test File for SCC MultiApi Plugin.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InlineResponse200CreateGameDTO.class))) + } ) @RequestMapping( method = RequestMethod.POST, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testOneOfInResponse/assets/GamesApi.java b/multiapi-engine/src/test/resources/openapigenerator/testOneOfInResponse/assets/GamesApi.java index 549b04fc..f6573a4e 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testOneOfInResponse/assets/GamesApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testOneOfInResponse/assets/GamesApi.java @@ -26,12 +26,12 @@ public interface GamesApi { */ @Operation( - operationId = "listGames", - summary = "List all available games", - tags = {"games"}, - responses = { - @ApiResponse(responseCode = "200", description = "A paged array of games", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InlineResponse200ListGamesOneOfDTO.class))) - } + operationId = "listGames", + summary = "List all available games", + tags = {"games"}, + responses = { + @ApiResponse(responseCode = "200", description = "A paged array of games", content = @Content(mediaType = "application/json", schema = @Schema(implementation = InlineResponse200ListGamesOneOfDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testQueryParam/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testQueryParam/assets/TestApi.java index cd2b24a0..0cdafb06 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testQueryParam/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testQueryParam/assets/TestApi.java @@ -26,11 +26,11 @@ public interface TestApi { */ @Operation( - operationId = "testReactiveQueryParam", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "An object with a list of strings", content = @Content(mediaType = "application/json", schema = @Schema(implementation = String.class))) - } + operationId = "testReactiveQueryParam", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "An object with a list of strings", content = @Content(mediaType = "application/json", schema = @Schema(implementation = String.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testReferenceFile/assets/TestApi.java b/multiapi-engine/src/test/resources/openapigenerator/testReferenceFile/assets/TestApi.java index 9c1b7814..3e2e4504 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testReferenceFile/assets/TestApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testReferenceFile/assets/TestApi.java @@ -26,11 +26,11 @@ public interface TestApi { */ @Operation( - operationId = "testFile", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "Some schema from another file", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))) - } + operationId = "testFile", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "Some schema from another file", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/multiapi-engine/src/test/resources/openapigenerator/testRestrictionsSchema/assets/SchemaMasterApi.java b/multiapi-engine/src/test/resources/openapigenerator/testRestrictionsSchema/assets/SchemaMasterApi.java index 3f92fd06..d84a9e88 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testRestrictionsSchema/assets/SchemaMasterApi.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testRestrictionsSchema/assets/SchemaMasterApi.java @@ -27,13 +27,13 @@ public interface SchemaMasterApi { */ @Operation( - operationId = "getSchemaMaster", - tags = {"SchemaMaster"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = SchemaDTO.class))), - @ApiResponse(responseCode = "400", description = "Bad Request"), - @ApiResponse(responseCode = "500", description = "Server Error") - } + operationId = "getSchemaMaster", + tags = {"SchemaMaster"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = SchemaDTO.class))), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "500", description = "Server Error") + } ) @RequestMapping( method = RequestMethod.GET, @@ -52,13 +52,13 @@ default ResponseEntity getSchemaMaster(@Parameter(name = "subject", d */ @Operation( - operationId = "createSchemaMaster", - tags = {"SchemaMaster"}, - responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = SchemaDTO.class))), - @ApiResponse(responseCode = "400", description = "Bad Request"), - @ApiResponse(responseCode = "500", description = "Server Error") - } + operationId = "createSchemaMaster", + tags = {"SchemaMaster"}, + responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = SchemaDTO.class))), + @ApiResponse(responseCode = "400", description = "Bad Request"), + @ApiResponse(responseCode = "500", description = "Server Error") + } ) @RequestMapping( method = RequestMethod.POST, diff --git a/scs-multiapi-gradle-plugin/build.gradle b/scs-multiapi-gradle-plugin/build.gradle index ef34fa75..eb7d95d7 100644 --- a/scs-multiapi-gradle-plugin/build.gradle +++ b/scs-multiapi-gradle-plugin/build.gradle @@ -20,7 +20,7 @@ repositories { } group = 'com.sngular' -version = '4.9.6' +version = '4.9.7' def SCSMultiApiPluginGroupId = group def SCSMultiApiPluginVersion = version @@ -30,7 +30,7 @@ dependencies { shadow localGroovy() shadow gradleApi() - implementation 'com.sngular:multiapi-engine:4.9.6' + implementation 'com.sngular:multiapi-engine:4.9.7' testImplementation 'org.assertj:assertj-core:3.23.1' testImplementation 'com.puppycrawl.tools:checkstyle:10.3.1' } diff --git a/scs-multiapi-maven-plugin/pom.xml b/scs-multiapi-maven-plugin/pom.xml index fde30668..73f3aec7 100644 --- a/scs-multiapi-maven-plugin/pom.xml +++ b/scs-multiapi-maven-plugin/pom.xml @@ -4,7 +4,7 @@ com.sngular scs-multiapi-maven-plugin - 4.9.6 + 4.9.7 maven-plugin AsyncApi - OpenApi Code Generator Maven Plugin @@ -233,7 +233,7 @@ com.sngular multiapi-engine - 4.9.6 + 4.9.7 org.apache.maven diff --git a/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/multiapi/integration/test/ScsMultiapiGenerationIT/testMultiapiGeneratedSourcesFolder/assets/TestApi.java b/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/multiapi/integration/test/ScsMultiapiGenerationIT/testMultiapiGeneratedSourcesFolder/assets/TestApi.java index c2b45dab..a172a5b6 100644 --- a/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/multiapi/integration/test/ScsMultiapiGenerationIT/testMultiapiGeneratedSourcesFolder/assets/TestApi.java +++ b/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/multiapi/integration/test/ScsMultiapiGenerationIT/testMultiapiGeneratedSourcesFolder/assets/TestApi.java @@ -16,57 +16,57 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.NativeWebRequest; -import com.sngular.generator.multiapi.rest.model.ApiTestInfoDTO; -import com.sngular.generator.multiapi.rest.model.ApiErrorDTO; import com.sngular.generator.multiapi.rest.model.ApiTestDTO; +import com.sngular.generator.multiapi.rest.model.ApiErrorDTO; +import com.sngular.generator.multiapi.rest.model.ApiTestInfoDTO; public interface TestApi { /** - * GET /test/{testId}: Info for a specific test - * @param testId The id of the test to retrieve true - * @return Expected response to a valid request; (status code 200) + * GET /test: List all available test + * @return A paged array of tests; (status code 200) */ @Operation( - operationId = "showTestById", - summary = "Info for a specific test", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestInfoDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) - } + operationId = "listTest", + summary = "List all available test", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, - value = "/test/{testId}", + value = "/test", produces = {"application/json"} ) - default ResponseEntity showTestById(@Parameter(name = "testId", description = "The id of the test to retrieve", required = true, schema = @Schema(description = "")) @PathVariable("testId") Integer testId) { + default ResponseEntity listTest() { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } /** - * GET /test: List all available test - * @return A paged array of tests; (status code 200) + * GET /test/{testId}: Info for a specific test + * @param testId The id of the test to retrieve true + * @return Expected response to a valid request; (status code 200) */ @Operation( - operationId = "listTest", - summary = "List all available test", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) - } + operationId = "showTestById", + summary = "Info for a specific test", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestInfoDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, - value = "/test", + value = "/test/{testId}", produces = {"application/json"} ) - default ResponseEntity listTest() { + default ResponseEntity showTestById(@Parameter(name = "testId", description = "The id of the test to retrieve", required = true, schema = @Schema(description = "")) @PathVariable("testId") Integer testId) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } diff --git a/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/multiapi/integration/test/ScsMultiapiGenerationIT/testScsMultiapiGeneration/assets/TestApi.java b/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/multiapi/integration/test/ScsMultiapiGenerationIT/testScsMultiapiGeneration/assets/TestApi.java index c2b45dab..a172a5b6 100644 --- a/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/multiapi/integration/test/ScsMultiapiGenerationIT/testScsMultiapiGeneration/assets/TestApi.java +++ b/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/multiapi/integration/test/ScsMultiapiGenerationIT/testScsMultiapiGeneration/assets/TestApi.java @@ -16,57 +16,57 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.NativeWebRequest; -import com.sngular.generator.multiapi.rest.model.ApiTestInfoDTO; -import com.sngular.generator.multiapi.rest.model.ApiErrorDTO; import com.sngular.generator.multiapi.rest.model.ApiTestDTO; +import com.sngular.generator.multiapi.rest.model.ApiErrorDTO; +import com.sngular.generator.multiapi.rest.model.ApiTestInfoDTO; public interface TestApi { /** - * GET /test/{testId}: Info for a specific test - * @param testId The id of the test to retrieve true - * @return Expected response to a valid request; (status code 200) + * GET /test: List all available test + * @return A paged array of tests; (status code 200) */ @Operation( - operationId = "showTestById", - summary = "Info for a specific test", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestInfoDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) - } + operationId = "listTest", + summary = "List all available test", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, - value = "/test/{testId}", + value = "/test", produces = {"application/json"} ) - default ResponseEntity showTestById(@Parameter(name = "testId", description = "The id of the test to retrieve", required = true, schema = @Schema(description = "")) @PathVariable("testId") Integer testId) { + default ResponseEntity listTest() { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } /** - * GET /test: List all available test - * @return A paged array of tests; (status code 200) + * GET /test/{testId}: Info for a specific test + * @param testId The id of the test to retrieve true + * @return Expected response to a valid request; (status code 200) */ @Operation( - operationId = "listTest", - summary = "List all available test", - tags = {"test"}, - responses = { - @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) - } + operationId = "showTestById", + summary = "Info for a specific test", + tags = {"test"}, + responses = { + @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiTestInfoDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiErrorDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, - value = "/test", + value = "/test/{testId}", produces = {"application/json"} ) - default ResponseEntity listTest() { + default ResponseEntity showTestById(@Parameter(name = "testId", description = "The id of the test to retrieve", required = true, schema = @Schema(description = "")) @PathVariable("testId") Integer testId) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } diff --git a/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/openapi/integration/test/OpenApiGenerationIT/testApiMultiGeneration/assets/TestFirstApi.java b/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/openapi/integration/test/OpenApiGenerationIT/testApiMultiGeneration/assets/TestFirstApi.java index 0a814ed1..ad4fe412 100644 --- a/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/openapi/integration/test/OpenApiGenerationIT/testApiMultiGeneration/assets/TestFirstApi.java +++ b/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/openapi/integration/test/OpenApiGenerationIT/testApiMultiGeneration/assets/TestFirstApi.java @@ -28,13 +28,13 @@ public interface TestFirstApi { */ @Operation( - operationId = "listTest", - summary = "List all available test", - tags = {"testFirst"}, - responses = { - @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestFirstDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorFirstDTO.class))) - } + operationId = "listTest", + summary = "List all available test", + tags = {"testFirst"}, + responses = { + @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestFirstDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorFirstDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, @@ -52,13 +52,13 @@ default ResponseEntity listTest() { */ @Operation( - operationId = "showTestById", - summary = "Info for a specific test", - tags = {"testFirst"}, - responses = { - @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestInfoFirstDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorFirstDTO.class))) - } + operationId = "showTestById", + summary = "Info for a specific test", + tags = {"testFirst"}, + responses = { + @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestInfoFirstDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorFirstDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, diff --git a/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/openapi/integration/test/OpenApiGenerationIT/testApiMultiGeneration/assets/TestSecondApi.java b/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/openapi/integration/test/OpenApiGenerationIT/testApiMultiGeneration/assets/TestSecondApi.java index a77b881e..4c260533 100644 --- a/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/openapi/integration/test/OpenApiGenerationIT/testApiMultiGeneration/assets/TestSecondApi.java +++ b/scs-multiapi-maven-plugin/src/test/resources-its/com/sngular/api/generator/openapi/integration/test/OpenApiGenerationIT/testApiMultiGeneration/assets/TestSecondApi.java @@ -28,13 +28,13 @@ public interface TestSecondApi { */ @Operation( - operationId = "listTest", - summary = "List all available test", - tags = {"testSecond"}, - responses = { - @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestSecondDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorSecondDTO.class))) - } + operationId = "listTest", + summary = "List all available test", + tags = {"testSecond"}, + responses = { + @ApiResponse(responseCode = "200", description = "A paged array of tests", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestSecondDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorSecondDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET, @@ -52,13 +52,13 @@ default ResponseEntity listTest() { */ @Operation( - operationId = "showTestById", - summary = "Info for a specific test", - tags = {"testSecond"}, - responses = { - @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestInfoSecondDTO.class))), - @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorSecondDTO.class))) - } + operationId = "showTestById", + summary = "Info for a specific test", + tags = {"testSecond"}, + responses = { + @ApiResponse(responseCode = "200", description = "Expected response to a valid request", content = @Content(mediaType = "application/json", schema = @Schema(implementation = TestInfoSecondDTO.class))), + @ApiResponse(responseCode = "default", description = "unexpected error", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ErrorSecondDTO.class))) + } ) @RequestMapping( method = RequestMethod.GET,