pyeve / eve-swagger

Swagger extension for Eve-powered RESTful APIs
http://python-eve.org
Other
154 stars 43 forks source link

Added description fields to swagger doc. #15

Closed stratosgear closed 8 years ago

stratosgear commented 8 years ago

Just add a 'description' field in each validation rule in settings.py

stratosgear commented 8 years ago

@nicolaiarocci I get a weird behavior now on my production server where it complains about:

...
...
9/13/2016 12:50:18 PM  File "/usr/local/lib/python2.7/dist-packages/cerberus/cerberus.py", line 175, in __init__
9/13/2016 12:50:18 PM    self.validate_schema(self.schema)
9/13/2016 12:50:18 PM  File "/usr/local/lib/python2.7/dist-packages/cerberus/cerberus.py", line 451, in validate_schema
9/13/2016 12:50:18 PM    constraint, field))
9/13/2016 12:50:18 PMSchemaError: unknown rule 'description' for field 'description'

But on my development server it was working fine.

I'm using Eve 0.6.4 and Cerberus 0.9.2 (both pip installed) and I'm scrambling now to figure why I have this discrepancy.

It seems that Cerberus does not like "random" keys in the validation rules. Is there a way to make him ignore them? Initial I thought Eve's ALLOW_UNKNOWN would be a solution, but this should not work because the issue is NOT allowing unknown resource attributes to be submitted but for Cerberus to allow arbitrary fields in the validation rules.

Any ideas what switches to use? Or where to patch it?

Also is this considered a Cerberus "bug"?

stratosgear commented 8 years ago

OK, gotta turn on TRANSPARENT_SCHEMA_RULES on settings.py. Apparently this was by default on in an older version of Eve?

nicolaiarocci commented 8 years ago

Merged after rebase, see 253088f