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

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


None yet
2 participants
Copy link

nicolas-leydet commented Sep 14, 2018

What OS are you using?

SLED 12.3

What version of molten are you using?


What did you do?

Use the following Schema as an handler return annotation

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/", 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/", 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/", 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/", 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


This comment has been minimized.

Copy link

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


This comment has been minimized.

Copy link

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