Skip to content

Commit d37ce66

Browse files
committed
better home
1 parent d112f65 commit d37ce66

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/main/groovy/com/github/hauner/openapi/spring/model/EndpointResponse.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ class EndpointResponse {
3636

3737

3838
String getResponseType () {
39-
main.responseType.name
39+
if (hasMultipleResponses ()) {
40+
'?'
41+
} else {
42+
main.responseType.name
43+
}
4044
}
4145

4246
String getContentType () {

src/main/groovy/com/github/hauner/openapi/spring/writer/MethodWriter.groovy

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,10 @@ class MethodWriter {
3737
void write (Writer target, Endpoint endpoint, EndpointResponse endpointResponse) {
3838
target.write ("""\
3939
${createMappingAnnotation (endpoint, endpointResponse)}
40-
ResponseEntity<${getResponseEntityType(endpointResponse)}> ${createMethodName (endpoint, endpointResponse)}(${createParameters(endpoint)});
40+
ResponseEntity<${endpointResponse.responseType}> ${createMethodName (endpoint, endpointResponse)}(${createParameters(endpoint)});
4141
""")
4242
}
4343

44-
private String getResponseEntityType (EndpointResponse endpointResponse) {
45-
if (endpointResponse.hasMultipleResponses ()) {
46-
'?'
47-
} else {
48-
endpointResponse.responseType
49-
}
50-
}
51-
5244
private String createMappingAnnotation (Endpoint endpoint, EndpointResponse endpointResponse) {
5345
String mapping = "${endpoint.method.mappingAnnotation}"
5446
mapping += "("

0 commit comments

Comments
 (0)