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

Meta Class fields not inherited #162

Closed
stephenfin opened this Issue Mar 8, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@stephenfin

stephenfin commented Mar 8, 2015

Take two models that demonstrate inheritance:

class BaseSchema(Schema):
    """Base serializer."""
    id = fields.Integer(dump_only=True)
    created_at = fields.DateTime(dump_only=True)

    class Meta:
        ordered = True

class PersonSchema(BaseSchema):
    """Person serializer."""
    updated_at = fields.DateTime(dump_only=True)
    name = fields.String()
    email = fields.Email(required=True)

The PersonSchema schema inherits all the attributes of the BaseSchema, as expected. However, it does not seem to inherit the meta attributes (i.e. ordered). To ensure ordered output, it is necessary to include these two lines in every model:

class Meta:
    ordered = True

I don't know if this is something that could be solved or not (I'm not all that familiar with the implementation of these 'Meta' classes).

@sloria

This comment has been minimized.

Member

sloria commented Mar 10, 2015

Thanks for reporting @stephenfin . I will try to address this bug and release a hotfix this weekend.

@sloria sloria closed this in 927704b Mar 12, 2015

@sloria

This comment has been minimized.

Member

sloria commented Mar 12, 2015

This is fixed on the dev and 1.2-line branch. I will make a release soon.

@sloria

This comment has been minimized.

Member

sloria commented Mar 16, 2015

This is now released to the PyPI

@stephenfin

This comment has been minimized.

stephenfin commented Mar 18, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment