APIFairy
APIFairy copied to clipboard
Schema in separate file
How to declare Schema in separate file? As well as using blueprints?
I don't understand. There is absolutely no required structure. You can put your schemas anywhere you like.
When defining schema in separate file how do we go about setting it up.
I'm doing this
#UserSchema.py from app import ma
class UserSchema(ma.Schema): email = Str()
I get a ton of import errors doing that.
I can't really tell you how to fix this, but it is a structural problem in your app. See https://github.com/miguelgrinberg/microblog-api for an example application with schemas on a schemas.py file.
Reference in new iss
If that is circular imports then change to import ma from another file, for example utils.