File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
openapi-processor-core/src
main/kotlin/io/openapiprocessor/core/model
test/groovy/com/github/hauner/openapi/core/writer/java Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,7 @@ class Endpoint(
227227 .filterKeys { ! it.startsWith(" 2" ) }
228228 .values
229229 .map { it.first() }
230+ .filter { ! it.empty }
230231 .toSet()
231232 }
232233
Original file line number Diff line number Diff line change @@ -307,6 +307,29 @@ class MethodWriterSpec extends Specification {
307307"""
308308 }
309309
310+ void "writes method with success response type when it has only empty error responses" () {
311+ def endpoint = createEndpoint (path: '/foo', method: HttpMethod.GET, responses: [
312+ '200' : [
313+ new Response ('application/json', new StringDataType ())
314+ ],
315+ '400': [
316+ new EmptyResponse ()
317+ ],
318+ '500': [
319+ new EmptyResponse ()
320+ ]
321+ ])
322+
323+ when:
324+ writer.write (target, endpoint, endpoint.endpointResponses.first ())
325+
326+ then:
327+ target.toString () == """ \
328+ @CoreMapping
329+ String getFoo ();
330+ """
331+ }
332+
310333 void "writes method with 'Object' response when it has multiple result content types (200, default)" () {
311334 def endpoint = createEndpoint (path: '/foo', method: HttpMethod.GET, responses: [
312335 '200' : [
You can’t perform that action at this time.
0 commit comments