Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Can't resolve type from:(integer, None) #68

Closed
WillaLuo opened this issue Feb 20, 2016 · 4 comments
Closed

ValueError: Can't resolve type from:(integer, None) #68

WillaLuo opened this issue Feb 20, 2016 · 4 comments

Comments

@WillaLuo
Copy link

Hi,
I meet a problem. When I use pyswagger generate a client to call api, I first do Authenticate which is the api my project provide, and then call an api whose OperationId is "discoverImageList".
The first authenticate call is correct, but the second call occur error, I don't know why.

Traceback (most recent call last):
File "/scratch/shuluo/swagger/swagger_sdk/compute-controlplane/devscripts/swaggerclient/new 2.py", line 16, in
aa = client.request(app.op"discoverImageList")
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/contrib/client/requests.py", line 55, in request
raw=six.StringIO(rs.content).getvalue()
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/io.py", line 361, in apply_with
self.data = r.schema.prim(data, self.__op._prim_factory)
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/spec/v2_0/objects.py", line 92, in prim
return prim_factory.produce(self, v)
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/primitives/__init
.py", line 184, in produce
val = ret.apply_with(obj, val, ctx)
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/primitives/_model.py", line 26, in apply_with
self[k] = ctx['factory'].produce(pobj, v)
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/primitives/init.py", line 180, in produce
val = _2nd(obj, ret, val, ctx)
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/primitives/comm.py", line 40, in _2nd_pass_obj
return ret.apply_with(obj, val, ctx)
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/primitives/_array.py", line 37, in apply_with
self.extend(map(functools.partial(ctx['factory'].produce, obj.items), val))
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/primitives/init.py", line 184, in produce
val = ret.apply_with(obj, val, ctx)
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/primitives/_model.py", line 26, in apply_with
self[k] = ctx['factory'].produce(pobj, v)
File "/scratch/shuluo/swagger/swagger_sdk/pyclient/compute-controlplane/virtualenv/lib/python2.6/site-packages/pyswagger/primitives/init.py", line 176, in produce
raise ValueError('Can't resolve type from:(' + str(obj.type) + ', ' + str(obj.format) + ')')
ValueError: Can't resolve type from:(integer, None)

@mission-liao
Copy link
Member

Hi, this issue might be duplicated with #65
Could you try the solution I provided in that issue first? If it doesn't work, please feel free to let me know, and a reproducible code/schema would be helpful.

@WillaLuo
Copy link
Author

Thanks! Appreciate for you reply. Hope for this bug fixed soon.^v^

@mission-liao
Copy link
Member

This issue won't be fixed because (integer, None) is actually not defined in Swagger Spec. They prefer explicit definition and only (integer, int32) or (integer, int64) is acceptable. For things not defined in spec, you would need to workaround by the solution I provided in that issue.

@WillaLuo
Copy link
Author

Ok, thanks! Mission, I also meet another problem, I open another issue, Can you please look at it?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants