pyeve / eve-swagger

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

Bug when defining sub-resources inside resources #52

Closed abilinx closed 6 years ago

abilinx commented 7 years ago

I've defined resources that contains other resources and when run eve server with eve-swagger enabled, this exception is raised:

[2017-09-13 15:55:17,566] ERROR in app: Exception on /api-docs [GET] Traceback (most recent call last): File "./flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "./flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "./flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "./flask/_compat.py", line 33, in reraise raise value File "./flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "./flask/app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "./eve_swagger/swagger.py", line 38, in decorated resp = make_response(f(*args, **kwargs)) File "./eve_swagger/swagger.py", line 100, in index node(root, 'definitions', definitions()) File "./eve_swagger/definitions.py", line 19, in definitions dr_sources.update(_get_dr_sources(rd['schema'])) File "./eve_swagger/definitions.py", line 167, in _get_dr_sources if rules.get('type') in 'dict': TypeError: 'in ' requires string as left operand, not NoneType

Line 167 of definitions.py seemed weird to me. I've edited the line to be: if rules.get('type') is 'dict': I used 'is' operator instead of 'in' and it worked pretty well.

I filed an issue some days ago and it's closed now because it seemed to be not relevant. Maybe this issue is related to that one here because the stack trace of exception looks familiar to me: https://github.com/pyeve/eve-swagger/issues/50 If you fix it, I can test it and it can be a fix for two issues!

Please correct it if it's a bug.

Thank you in advance

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.