swagger-api / swagger-api/swagger-codegen
[Objc] ResponseDeserializer Type Mismatch Error
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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