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

Native schema support #22

Open
pdiazvargas opened this issue Mar 31, 2019 · 0 comments
Open

Native schema support #22

pdiazvargas opened this issue Mar 31, 2019 · 0 comments

Comments

@pdiazvargas
Copy link
Contributor

What

I want to have the ability to define an object schema using a library like marshmallow.

The schema definition should validate as well as automatically convert a given payload to an instance of the object as defined by the schema. Proposed syntax:

class ArtistSchema(Schema):
    name = fields.Str()

@app.route('/artist', methods=['POST'], schema=ArtistSchema())
def create_artist():
    artist = app.request.object
    save_artist(artist)
    return {"name": artist.name}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant