OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.72k stars 6.55k forks source link

[Swift4] Does generator generate error responses for requests? #1455

Open andreyshade opened 5 years ago

andreyshade commented 5 years ago
Description

When I tried to generate swift client for yaml file contains different types of responses. For example:

 responses:
        '200':
          description: OK
        '400':
          description: Bad request. User ID must be an integer and larger than 0.
        '401':
          description: Authorization information is missing or invalid.
        '404':
          description: A user with the specified ID was not found.
        '5XX':
          description: Unexpected error.

It will generate only 200 response. How to generate another responses?

wing328 commented 5 years ago

Is it correct to say that these error descriptions are included in the HTTP response body? If yes, then I think the exception should probably contain the "description" (at least that's how we do it in Ruby, PHP, C#, etc client)

andreyshade commented 5 years ago

No, I mean about generated client code which include only handling 200 response only