The swagger spec I'm calling don't define "collectionFormat" as the default value, according to OAI spec, is "csv".
But, currently, when i'm doing call with arrays, pyswagger always return "None" for the collectionFormat instead of "csv" and I have this error:
>>> from pyswagger import App
>>> app = App.create('https://esi.tech.ccp.is/latest/swagger.json')
>>> app.op['get_characters_names'](character_ids=[90000001])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "F:\Code\LazyBlacksmith\env\lib\site-packages\pyswagger\spec\v2_0\objects.py", line 283, in __call__
_convert_parameter(final(p))
File "F:\Code\LazyBlacksmith\env\lib\site-packages\pyswagger\spec\v2_0\objects.py", line 274, in _convert_parameter
params[i].extend([tuple([p.name, v]) for v in c.to_url()])
File "F:\Code\LazyBlacksmith\env\lib\site-packages\pyswagger\primitives\_array.py", line 79, in to_url
return [str(self)]
File "F:\Code\LazyBlacksmith\env\lib\site-packages\pyswagger\primitives\_array.py", line 70, in __str__
raise SchemaError('Unsupported collection format when converting to str: {0}'.format(self.__collection_format))
pyswagger.errs.SchemaError: Unsupported collection format when converting to str: None
After digging a little in pyswagger code, what i've found is that this line https://github.com/mission-liao/pyswagger/blob/master/pyswagger/primitives/_array.py#L20 always return "None" instead of "csv".
So i checked that value, and no matter what it's always at "None".
So far, i've found a way to avoid this issue ( but I don't actually know if there will be some impacts on the other endpoints) by adding this before I create my App object :
from pyswagger.spec.v2_0.objects import Parameter
Parameter.__swagger_fields__['collectionFormat']='csv'
So it gives:
>>> from pyswagger.spec.v2_0.objects import Parameter
>>> Parameter.__swagger_fields__['collectionFormat']='csv'
>>>
>>> from pyswagger import App
>>> app = App.create('https://esi.tech.ccp.is/latest/swagger.json')
>>> app.op['get_characters_names'](character_ids=[90000001])
(<pyswagger.io.Request object at 0x0468CA50>, <pyswagger.io.Response object at 0x04E4A4B0>)
Thank you for your help and answers
The swagger spec I'm calling don't define "collectionFormat" as the default value, according to OAI spec, is "csv".
But, currently, when i'm doing call with arrays, pyswagger always return "None" for the collectionFormat instead of "csv" and I have this error:
After digging a little in pyswagger code, what i've found is that this line https://github.com/mission-liao/pyswagger/blob/master/pyswagger/primitives/_array.py#L20 always return "None" instead of "csv".
So i checked that value, and no matter what it's always at "None".
So far, i've found a way to avoid this issue ( but I don't actually know if there will be some impacts on the other endpoints) by adding this before I create my App object :
So it gives:
Thank you for your help and answers