Skip to content

Python - swagger.mustache doesn't appear to deserialize models correctly #281

Closed
@dylangleason

Description

@dylangleason

I have a model with the following specification:

AuthResponse {
    success (int),
    error (Error),
    results (Auth)
}
Error {
    message (string),
    code (int)
}
Auth {
    username (string),
    accessToken (string),
    mode (int),
    clientIp (string)
}

With the following model:

class AuthResponse:

    def __init__(self):
        self.swaggerTypes = {
            'success': 'int',
            'error': 'Error',
            'results': 'Auth'

        }


        self.success = None # int
        self.error = None # Error
        self.results = None # Auth

    def __repr__(self):
        return "<AuthResponse success:%s error:%s results:%s>" % (self.success, self.error, self.results)

However, I noted that swagger.mustache (https://github.com/wordnik/swagger-codegen/blob/master/src/main/resources/python/swagger.mustache) seems to deserialize the object thusly after getting a response from the server:

<AuthResponse success:0 error:<AuthResponse success:None error:None results:None> results:<AuthResponse success:None error:None results:None>>

It doesn't appear that it is correctly deserializing, i.e. the error field contains another AuthResponse object instead of an Error model, and no Auth object in the results field.

Has anyone run into this before? Using the same swagger resource file, I don't appear to have this problem with the PHP client.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions