Closed AYEG closed 5 years ago
Resolved! This error had nothing to do with apispec or other library versions. I made a mistake declaring a field in use_kwargs. Instead of "avatar_color" : fields.Str(), I had already placed random.choice(avatar_colors) instead of inside the function. In addition I forgot a function argument elsewhere
Sorry for the delay! I was busy building FastAPI.
I'm glad you solved your problem.
Just so you have it in mind: Webargs doesn't declare all the fields from Marshmallow, although it does expose them.
So, it would actually work, but Pylint, type checks, completion, etc won't work well. (That's why I designed FastAPI around auto-completion and editor support, learning a lot of the ideas from Marshmallow, Webargs and family).
You can use fields
from Marshmallow, but have in mind that only when using fields
from Webargs you can use Nested
and DelimitedList
: https://webargs.readthedocs.io/en/latest/api.html#module-webargs.fields
Hi! I'm attempting to run the flask app with flask manager. I've simplified it abit from my last project, and it seems to be working.
Using it like this: run command $ python test-app/backend/app/manage.py runserver manage.py:
It's been helpful already in quickly correcting a few mistakes I made instead of rebuilding the docker images. The problem I can't seem to resolve right now is, I'm running into this strange apispec error:
I haven't specified a specified an apispec version during install, should I be using an older version? Or could this be related to python 2x vs python 3x?
There are also pylint errors throughout the endpoint files on fields.Str() objects which shows:
Update: When importing import marshmallow.fields as fields instead of from webargs import fields the pylint error is not shown anymore, but the marshmallow openapi.py error remains. AttributeError: 'str' object has no attribute 'dump_only'.
Br