Closed c-martinez closed 8 years ago
Thanks for the PR, and sorry for the delay.
Why not just:
if def_spec.get('type') == 'array and 'items' in def_spec:
self.definitions_example[def_name] = [ self.build_one_definition_example(self.get_definition_name_from_ref(def_spec['items']))]
return True
if 'properties' in ....
See https://stackoverflow.com/questions/21069668/alternative-to-dict-comprehension-prior-to-python-2-7 for your test error.
Thanks. Would this work better?
Why not just:
if def_spec.get('type') == 'array and 'items' in def_spec:
self.definitions_example[def_name] = [ self.build_one_definition_example(self.get_definition_name_from_ref(def_spec['items']))]
return True
if 'properties' in ....
And do you want to make some test for this specific case (I can do it if you want) ?
Hmmm... I think that would fail if def_spec
does not have a type defined or if items
doesn't have a ref
, wouldn't it?
Any news on merging this?
Sorry for the wait.
@c-martinez I think the definition should have the type defined to array
for array definitions. And do you have an example of items without $ref ? Also can you add a test for your changes ?
Hi @cyprieng ,
I think you are right about the array
definition. But you can have items without $ref
:
StringArray:
type: array
items:
type: string
Tests -- yes, sorry, should have written them a while ago. Will append to this PR.
@c-martinez you're right. Thanks for the good work !
awesome guys! Thanks! 👏
Not sure it is 100% correct, but maybe it works