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

Problem with inheritance and Config.fields #55

Closed
samuelcolvin opened this Issue Jun 30, 2017 · 0 comments

Comments

1 participant
@samuelcolvin
Owner

samuelcolvin commented Jun 30, 2017

from pydantic import BaseModel


class Foo(BaseModel):
    a: int


class Bar(Foo):
    b: str

    class Config:
        fields = {
            'a': 'aaa',
            'b': 'bbb',
        }


print(Bar(aaa=1, bbb='s'))

Doesn't work.

  1. should give explicit error if fields which aren't defined are referenced in Config.fields
  2. should allow aliases for fields in inherited models.

@samuelcolvin samuelcolvin changed the title from error with inheritance and Config.fields to Problem with inheritance and Config.fields Jun 30, 2017

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