Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

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
bug Something isn't working

Comments

@nicolas-leydet
Copy link

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 commented Sep 18, 2018

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

@Bogdanp Bogdanp added the bug Something isn't working label Sep 18, 2018
@Bogdanp
Copy link
Owner

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants