swagger-api / swagger-api/swagger-codegen

[Swift4, Kotlin] get Custom object in Error response

Open
#9,661 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Hello.

I've got a problem with handling model from [Swift4,Kotlin] auto generating's code response.

The code was generated on https://editor.swagger.io/

and actually, I don't know how I can return the "genericConflict" model (error №409 in this example) that was described in showed part of the contract.

Yes, I can create an object from that manually, but my question is: How it could be resolved with swagger contact automatically as any response did and provided in swagger contract as the common way: https://swagger.io/docs/specification/describing-responses/

Swagger-codegen version

'2.0'

Code
/parcel/summary:
    put:
      tags:
        - Parcel
      operationId: GetParcelSummary
      description: "compute parcel amounts."
      parameters:
      - in : body
        name: "parcel"
        schema:
          $ref: "#/definitions/parcelForSummary"
        required: true
      responses:
        '200':
          description: "parcelSummary computation succeed"
          schema:
            $ref: "#/definitions/parcelSummaryResponse"
        '400':
          description: "parcelSummary computation failed"
        '409':
          description: "the data is in conflict with the possible data values"
          schema:
              $ref: '#/definitions/genericConflict'
Steps to reproduce

in web UI:
generateClient->Client for Swift4

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 by examining the generated Swift4 and Kotlin clients from the provided response contract, focusing on how non-200 responses are represented. Verify whether the genericConflict schema for status 409 is exposed automatically, and use the web UI reproduction to confirm that the generated clients provide the documented error model.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, swift
Domain
api, tooling
Issue type
Bug
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.