OpenAPITools / OpenAPITools/openapi-generator

[REQ] Swift5 client: support error response schema

Open
#12,555 0 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

When an error occurs on the server, the server responds with an error object which is specified in the OpenAPI file. Unfortunately, the swift client does not take into account this and return a parse error instead because it did not expect that object.

The bug https://github.com/OpenAPITools/openapi-generator/issues/5504 describes this well

Describe the solution you'd like

I'd like the swift client to take into account the schema defined for error responses and to parse the response according to that schema, so the response object can be used just like for 200 responses

Describe alternatives you've considered

Right now, i end up creating code in my error handling code to parse the object manually.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Swift client generation path and the OpenAPI file's error response schemas, using issue #5504 for context. Trace how successful responses are parsed and identify where an error object instead becomes a parse error. Done means generated Swift clients parse documented error responses into usable response objects rather than failing during parsing.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, swift
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.