swagger-api / swagger-api/swagger-codegen

[Swift] responses: schema: type: object --> RequestBuilder<Inline_response_200> ?

Open
#2,093 31 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Swift Enhancement: General help wanted
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

When I feed an API with the following responses definition:

      responses:
        '200':
          description: Request was successful
          schema:
            type: object

the codegen generates something like the following client-side code:

public class func usercount(Swaggerwhere Swaggerwhere: String?) -> RequestBuilder<Inline_response_200> {

where I don't understand how to handle the returned object value...?
I would expect an plain object is mapped to a dictionary so that access key-value pairs can be read...
Would you kindly tell me if I'm mistaking something?

When I tried Obj-C and it also behaves in a similar manner:

-(NSNumber*) userCountWithCompletionBlock :(NSString*) where
    completionHandler: (void (^)(XXInlineResponse200* output, NSError* error))completionBlock;

So, there might be some design decision already discussed and it has been decided to generate Inline_response_200 thing for object response type. But I still don't see how to handle the returned object. Any help would be much appreciated! (@bajtos wanted to keep informed about this too)

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 YAML response schema and compare the generated Swift and Objective-C signatures for an inline object response. Inspect the language-generator handling for this response shape and existing generated-model conventions. Done means the generated client exposes a clear, usable representation of the returned object in both affected languages.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, swift
Domain
api, devtools
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.