Skip to content
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

HyperlinkModelSchema missing? #30

Closed
russelldavies opened this issue Nov 25, 2015 · 4 comments
Closed

HyperlinkModelSchema missing? #30

russelldavies opened this issue Nov 25, 2015 · 4 comments

Comments

@russelldavies
Copy link

HyperlinkModelSchema is mentioned in the docs and in docstrings but doesn't seem to actually exist anywhere. Not in this project nor marshmallow-sqlalchemy. Perhaps the documentation should be updated to refer to HyperlinkRelated instead?

@petertrotman
Copy link

I'm also having this issue - the Marshmallow object imported from flask_marshmallow has only Schema and ModelSchema; no HyperlinkModelSchema as the docs claim.

@geiseri
Copy link

geiseri commented Jan 18, 2016

+1 on this too. This looks like a feature that would be very cool :)

@sandervalcke
Copy link

Same here. Adding id = ma.UrlFor('task', id='<id>') in the schema works as a workaround, still have to see if that works for all use cases.

@diginikkari
Copy link

I was struggling with this also. Documentation seems to be quite outdated. There are no HyperlinkModelSchema anymore. Check commit #23 which introduced HyperlinkRelated class.

I learned how to use it by checking examples from test cases introduced in #23

This can be used like this:

from flask_marshmallow.sqla import HyperlinkRelated

...

class AuthorSchema(ma.ModelSchema):
    class Meta:
        model = Author
    books = ma.List(HyperlinkRelated('book'))

class BookSchema(ma.ModelSchema):
     class Meta:
         model = Book
     author = HyperlinkRelated('author')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants