File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed
main/groovy/com/github/hauner/openapi/spring/writer
test/groovy/com/github/hauner/openapi/spring/writer Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -109,24 +109,24 @@ class MethodWriter {
109109
110110 if (it. withAnnotation ()) {
111111 if (apiOptions. beanValidation){
112- methodDefinition + = " ${ beanValidationWriter.createAnnotations(it.dataType)} "
112+ methodDefinition + = " ${ beanValidationWriter.createAnnotations(it.dataType)} "
113113 }
114114
115- methodDefinition + = " ${ createParameterAnnotation (it)} "
115+ methodDefinition + = " ${ createParameterAnnotation (it)} "
116116 }
117117
118- methodDefinition + = " ${ it.dataType.name} ${ Identifier.toCamelCase (it.name)} "
119- methodDefinition
118+ methodDefinition + = " ${ it.dataType.name} ${ Identifier.toCamelCase (it.name)} "
119+ methodDefinition. trim()
120120 }
121121
122122 if (! endpoint. requestBodies. empty) {
123123 def body = endpoint. requestBody
124124 def beanValidationAnnotations = ' '
125125 if (apiOptions. beanValidation){
126- beanValidationAnnotations + = " ${ beanValidationWriter.createAnnotations(body.requestBodyType)} "
126+ beanValidationAnnotations + = " ${ beanValidationWriter.createAnnotations(body.requestBodyType)} "
127127 }
128128 def param = " ${ beanValidationAnnotations} ${ createRequestBodyAnnotation(body)} ${ body.requestBodyType.name} body"
129- ps. add (param)
129+ ps. add (param. trim() )
130130 }
131131
132132 ps. join (' , ' )
Original file line number Diff line number Diff line change 1616
1717package com.github.hauner.openapi.spring.writer
1818
19+ import com.github.hauner.openapi.spring.converter.ApiOptions
1920import com.github.hauner.openapi.spring.model.Endpoint
2021import com.github.hauner.openapi.spring.model.HttpMethod
2122import com.github.hauner.openapi.spring.model.Interface
@@ -37,8 +38,9 @@ import static com.github.hauner.openapi.spring.support.AssertHelper.extractImpor
3738class InterfaceWriterSpec extends Specification {
3839 def headerWriter = Mock HeaderWriter
3940 def methodWriter = Stub MethodWriter
41+ def apiOptions = new ApiOptions ()
4042
41- def writer = new InterfaceWriter (headerWriter : headerWriter, methodWriter : methodWriter)
43+ def writer = new InterfaceWriter (headerWriter : headerWriter, methodWriter : methodWriter, apiOptions : apiOptions )
4244 def target = new StringWriter ()
4345
4446 void " writes 'generated' comment" () {
Original file line number Diff line number Diff line change 1616
1717package com.github.hauner.openapi.spring.writer
1818
19+ import com.github.hauner.openapi.spring.converter.ApiOptions
1920import com.github.hauner.openapi.spring.model.Endpoint
2021import com.github.hauner.openapi.spring.model.HttpMethod
2122import com.github.hauner.openapi.spring.model.RequestBody
@@ -40,7 +41,8 @@ import spock.lang.Specification
4041import spock.lang.Unroll
4142
4243class MethodWriterSpec extends Specification {
43- def writer = new MethodWriter ()
44+ def apiOptions = new ApiOptions ()
45+ def writer = new MethodWriter (apiOptions : apiOptions)
4446 def target = new StringWriter ()
4547
4648 void " writes parameter less method without response" () {
You can’t perform that action at this time.
0 commit comments