mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-21 15:07:11 +00:00
Kotlin-Spring template fixes/improvements (#3007)
* Fixed case where invalid comma is added to consumes/produces list in case last element is empty. * Changed default HttpStatus.OK response to match first response code in definition. Allowing also other responses 201, 202 ... * Changed default HttpStatus.OK response to match first response code in definition. Allowing also other responses 201, 202 ... * run ./bin/kotlin-springboot-petstore-server.sh Updated APIs
This commit is contained in:
committed by
William Cheng
parent
6ff0512b31
commit
caac76c265
@@ -74,8 +74,8 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v
|
||||
value = ["{{#lambda.escapeDoubleQuote}}{{path}}{{/lambda.escapeDoubleQuote}}"],{{#singleContentTypes}}{{#hasProduces}}
|
||||
produces = "{{{vendorExtensions.x-accepts}}}",{{/hasProduces}}{{#hasConsumes}}
|
||||
consumes = "{{{vendorExtensions.x-contentType}}}",{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}}
|
||||
produces = [{{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}}], {{/hasProduces}}{{#hasConsumes}}
|
||||
consumes = [{{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}],{{/hasConsumes}}{{/singleContentTypes}}
|
||||
produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}], {{/hasProduces}}{{#hasConsumes}}
|
||||
consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}],{{/hasConsumes}}{{/singleContentTypes}}
|
||||
method = [RequestMethod.{{httpMethod}}])
|
||||
{{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> {
|
||||
return {{>returnValue}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{#serviceInterface}}ResponseEntity(service.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}), HttpStatus.OK){{/serviceInterface}}{{^serviceInterface}}ResponseEntity(HttpStatus.NOT_IMPLEMENTED){{/serviceInterface}}
|
||||
{{#serviceInterface}}ResponseEntity(service.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}), {{#responses}}{{#-first}}HttpStatus.valueOf({{code}}){{/-first}}{{/responses}}){{/serviceInterface}}{{^serviceInterface}}ResponseEntity(HttpStatus.NOT_IMPLEMENTED){{/serviceInterface}}
|
||||
Reference in New Issue
Block a user