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

'NoneType' object has no attribute 'description' #143

Closed
decentral1se opened this issue Jun 12, 2018 · 1 comment
Closed

'NoneType' object has no attribute 'description' #143

decentral1se opened this issue Jun 12, 2018 · 1 comment
Assignees
Labels
bug Bug report/fix

Comments

@decentral1se
Copy link

Firstly, thanks for this great library.

Now, in:

type=coreapi_types.get(type(field.schema), openapi.TYPE_STRING),

If we can't find out which type it is, we default to string.

However, later, we try to ask the schema description:

description=field.schema.description,

My field that is getting passed in, is from https://github.com/django-money/django-money, has no schema:

ipdb> field
Field(name=u'currency', required=False, location='query', schema=None, description=u'', type=None, example=None)
ipdb> type(field.schema)
<type 'NoneType'>
ipdb> field.schema.description
*** AttributeError: 'NoneType' object has no attribute 'description'

Not sure what to do exactly but it seems that we should make a field.schema is None check?

@decentral1se
Copy link
Author

Alternatively, I think I can create a ManualSchema field definition for this field via:

http://www.django-rest-framework.org/api-guide/schemas/

decentral1se added a commit to decentral1se/drf-yasg that referenced this issue Jun 12, 2018
decentral1se added a commit to decentral1se/drf-yasg that referenced this issue Jun 14, 2018
@axnsan12 axnsan12 added the bug Bug report/fix label Jun 16, 2018
@axnsan12 axnsan12 self-assigned this Jun 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report/fix
Projects
None yet
Development

No branches or pull requests

2 participants