We have problem with our generated API consumers.
Tried typescript-fetch and Java-SpringBoot generators.
If the endpoint has no documents for given id, the endpoint responses with a 204 code and an empty body.
But the generated controller code tries to parse the empty body as if it were a 200 code and leads into a parsing error.
swagger spec:
/api/v1/{id}/documents:
get:
tags:
- documents
summary: Gets the list of documents for id.
operationId: getDocs
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
"200":
description: Returns the document-list
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/AbstractCoEntry'
"204":
description: no documents in list
"401":
description: User is not authorized to read the documents
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorToken'
How do I need to specify the swagger endpoint to avoid the JSON parsing on consume?
Or how to handle this setup correctly for empty responses?