swagger-api / swagger-api/swagger-codegen
Missing deserializer for type (Klass) "Object"
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I can generate a mostly functional client, but I need to monkey patch the generated class to fix a missing deserializer for type "Object".
There is a deserializer for "object" lower case, which works fine, so I have to believe that it's simply a case of case confusion.
I resorted to this monkey-patch of the generated app_api class:
app_api.api_client.NATIVE_TYPES_MAPPING['Object'] =\
app_api.api_client.NATIVE_TYPES_MAPPING['object']
Not sure where the fault lies exactly, I didn't completely follow the deserializer mapping logic.
Swagger-codegen version
❯ swagger-codegen version
2.3.1
Have not tried any other version, this is a new project.
Swagger declaration file content or url
This is a snippet of the swagger 1.2 API file.
"Application": {
"properties": {
"globalState": {
"type": "Object"
},
}
Command line used for generation
swagger-codegen generate \
-i app.json \
-l python \
-o lib
Steps to reproduce
Upon receipt of a response containing the above "globalState" Object, which is a json string,
Suggest a fix/enhancement
Make the NATIVE_TYPES_MAPPING comparison case insensitive?
Here's a pic of the specific failure point:

Note the object vs Object discrepancy.
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 lib/app_api/api_client.py and inspect how response deserialization looks up Object versus object in NATIVE_TYPES_MAPPING. Reproduce it with the shown swagger-codegen generate command and app.json snippet; done means a Python client can deserialize the Object response without the monkey patch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100