swagger-api / swagger-api/swagger-codegen

[Objc] ResponseDeserializer Type Mismatch Error

Open
#7,135 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Objc Issue: Bug
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I have a response to be deserialized as NSDictionary<NSString*, NSArray<MbsmStationInfoDto>*> class. However while executing deserialize operation, it behaves like it's an array, and try to deserialize it as array.

Swagger-codegen version

v2.2.3

Suggest a fix/enhancement

I think, it is caused
match = [self.arrayOfModelsPatExpression firstMatchInString:className options:0 range:range];on generated class {Prefix}ResponseDeserializer.m returns a not null NSTextCheckingResult.
Thus
[self deserializeArrayValue:jsonData innerType:innerType error:error];
this line executed and Type Mismatch Error occured.

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 generated {Prefix}ResponseDeserializer.m and inspect how arrayOfModelsPatExpression matches NSDictionary<NSString*, NSArray<MbsmStationInfoDto*>*>. Reproduce the v2.2.3 deserialization behavior and verify that the declared dictionary response no longer produces a type mismatch error.

Written by the indexing model from the issue text.

Assessment

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