Closed hoegertn closed 4 years ago
The result type is retrieved from the success response, which has status code 2xx, generally 200. You only use default responses, which is normally handled to catch-any-error.
Thanks for the info. What do you think about using the default
response during generation if it is the only one in the spec?
According to the spec:
Sometimes, an operation can return multiple errors with different HTTP status codes, but all of them have the same response structure... You can use the default response to describe these errors collectively, not individually...
The default response is really meant for describing errors, not success responses.
Ok, I will see if I can adjust my generating code on the backend. Thanks for the pointer.
The generating library is only creating default
responses. As I read the spec, errors are a sample of a default response but not the only use case. So I still think that if there is only a default response it should be used to generate the code.
Which library are you using?
I can't even use Swagger generator because the specification is said to be invalid:
curl -X POST "https://generator.swagger.io/api/gen/clients/typescript-angular" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"swaggerUrl\": \"https://api.ebbrsodd.de/swagger.yaml\"}"
@luisfpg I'm getting a similar issue: I've a lot of responses with 2** that uses $refs and in the SDK generated they are all returning void...
@HighSoftWare96 Can you provide the OpenAPI descriptor?
I am generating an API client for the following OpenAPI spec: `https://api.ebbrsodd.de/swagger.yaml``
It works well as it generates all models and services but all the methods return
Observable<void>
and the type of the result isstring
instead of the model object.Any idea what I am missing here?