[Kotlin-Spring] fix arrays response api after generation (#16296)

* issues/16295 fix arrays response api after generation

* fix samples

* fix samples

---------

Co-authored-by: Lezenford <alex.v.plekhanov@gmail.com>
This commit is contained in:
Lezenford
2023-08-23 06:52:15 +04:00
committed by GitHub
parent 00de163655
commit 3e95001939
7 changed files with 12 additions and 12 deletions

View File

@@ -67,7 +67,7 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v
operationId = "{{{operationId}}}", operationId = "{{{operationId}}}",
description = """{{{unescapedNotes}}}""", description = """{{{unescapedNotes}}}""",
responses = [{{#responses}} responses = [{{#responses}}
ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content(schema = Schema(implementation = {{{baseType}}}::class))]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ]{{#hasAuthMethods}}, ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content({{#isArray}}array = ArraySchema({{/isArray}}schema = Schema(implementation = {{{baseType}}}::class)){{#isArray}}){{/isArray}}]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ]{{#hasAuthMethods}},
security = [ {{#authMethods}}SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = [ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} ]{{/isOAuth}}){{^-last}},{{/-last}}{{/authMethods}} ]{{/hasAuthMethods}} security = [ {{#authMethods}}SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = [ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} ]{{/isOAuth}}){{^-last}},{{/-last}}{{/authMethods}} ]{{/hasAuthMethods}}
){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} ){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}
@ApiOperation( @ApiOperation(

View File

@@ -77,7 +77,7 @@ interface {{classname}} {
operationId = "{{{operationId}}}", operationId = "{{{operationId}}}",
description = """{{{unescapedNotes}}}""", description = """{{{unescapedNotes}}}""",
responses = [{{#responses}} responses = [{{#responses}}
ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content(schema = Schema(implementation = {{{baseType}}}::class))]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content({{#isArray}}array = ArraySchema({{/isArray}}schema = Schema(implementation = {{{baseType}}}::class)){{#isArray}}){{/isArray}}]{{/baseType}}){{^-last}},{{/-last}}{{/responses}}
]{{#hasAuthMethods}}, ]{{#hasAuthMethods}},
security = [ {{#authMethods}}SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = [ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} ]{{/isOAuth}}){{^-last}},{{/-last}}{{/authMethods}} ]{{/hasAuthMethods}} security = [ {{#authMethods}}SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = [ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} ]{{/isOAuth}}){{^-last}},{{/-last}}{{/authMethods}} ]{{/hasAuthMethods}}
){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} ){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}

View File

@@ -74,7 +74,7 @@ class PetApiController() {
operationId = "findPetsByStatus", operationId = "findPetsByStatus",
description = """Multiple status values can be provided with comma separated strings""", description = """Multiple status values can be provided with comma separated strings""",
responses = [ responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid status value") ], ApiResponse(responseCode = "400", description = "Invalid status value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ] security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]
) )
@@ -92,7 +92,7 @@ class PetApiController() {
operationId = "findPetsByTags", operationId = "findPetsByTags",
description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""", description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""",
responses = [ responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid tag value") ], ApiResponse(responseCode = "400", description = "Invalid tag value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ] security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]
) )

View File

@@ -82,7 +82,7 @@ interface PetApi {
operationId = "findPetsByStatus", operationId = "findPetsByStatus",
description = """Multiple status values can be provided with comma separated strings""", description = """Multiple status values can be provided with comma separated strings""",
responses = [ responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid status value") ApiResponse(responseCode = "400", description = "Invalid status value")
], ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ] security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]
@@ -101,7 +101,7 @@ interface PetApi {
operationId = "findPetsByTags", operationId = "findPetsByTags",
description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""", description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""",
responses = [ responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid tag value") ApiResponse(responseCode = "400", description = "Invalid tag value")
], ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ] security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]

View File

@@ -72,7 +72,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
operationId = "findPetsByStatus", operationId = "findPetsByStatus",
description = """Multiple status values can be provided with comma separated strings""", description = """Multiple status values can be provided with comma separated strings""",
responses = [ responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid status value") ], ApiResponse(responseCode = "400", description = "Invalid status value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
) )
@@ -90,7 +90,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
operationId = "findPetsByTags", operationId = "findPetsByTags",
description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""", description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""",
responses = [ responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid tag value") ], ApiResponse(responseCode = "400", description = "Invalid tag value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
) )

View File

@@ -73,7 +73,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
operationId = "findPetsByStatus", operationId = "findPetsByStatus",
description = """Multiple status values can be provided with comma separated strings""", description = """Multiple status values can be provided with comma separated strings""",
responses = [ responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid status value") ], ApiResponse(responseCode = "400", description = "Invalid status value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
) )
@@ -91,7 +91,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
operationId = "findPetsByTags", operationId = "findPetsByTags",
description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""", description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""",
responses = [ responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid tag value") ], ApiResponse(responseCode = "400", description = "Invalid tag value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
) )

View File

@@ -72,7 +72,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
operationId = "findPetsByStatus", operationId = "findPetsByStatus",
description = """Multiple status values can be provided with comma separated strings""", description = """Multiple status values can be provided with comma separated strings""",
responses = [ responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid status value") ], ApiResponse(responseCode = "400", description = "Invalid status value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
) )
@@ -90,7 +90,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
operationId = "findPetsByTags", operationId = "findPetsByTags",
description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""", description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""",
responses = [ responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid tag value") ], ApiResponse(responseCode = "400", description = "Invalid tag value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
) )