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

A schema's field cannot be of type List[str] #12

Closed
nicolas-leydet opened this issue Sep 14, 2018 · 2 comments
Closed

A schema's field cannot be of type List[str] #12

nicolas-leydet opened this issue Sep 14, 2018 · 2 comments
Labels

Comments

@nicolas-leydet
Copy link

@nicolas-leydet nicolas-leydet commented Sep 14, 2018

What OS are you using?

SLED 12.3

What version of molten are you using?

0.50

What did you do?

Use the following Schema as an handler return annotation

@schema
class SearchResult:
    results: List[str]

What did you expect would happen?

No error

What happened?

File "~/.virtualenvs/matching/lib/python3.7/site-packages/molten/openapi/documents.py", line 239, in generate_openapi_document
    response_schema_name = _generate_schema("response", response_annotation, schemas)
  File "~/.virtualenvs/matching/lib/python3.7/site-packages/molten/openapi/documents.py", line 319, in _generate_schema
    is_optional, field_schema = _generate_field_schema(field, context, schemas)
  File "~/.virtualenvs/matching/lib/python3.7/site-packages/molten/openapi/documents.py", line 345, in _generate_field_schema
    item_schema_name = _generate_schema(context, arguments[0], schemas)
  File "~/.virtualenvs/matching/lib/python3.7/site-packages/molten/openapi/documents.py", line 303, in _generate_schema
    for field in schema._FIELDS.values():  # noqa
AttributeError: 'function' object has no attribute '_FIELDS'

this is not valid if you use anything else than a schema as List argument

@Bogdanp
Copy link
Owner

@Bogdanp Bogdanp commented Sep 18, 2018

Thanks! I'll take a look at this this weekend.

@Bogdanp Bogdanp added the bug label Sep 18, 2018
@Bogdanp Bogdanp closed this in 2ca61be Sep 23, 2018
@Bogdanp
Copy link
Owner

@Bogdanp Bogdanp commented Sep 23, 2018

Thanks again for reporting this! I've released a fix in version 0.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants