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

Problem with inheritance and Config.fields #55

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

Problem with inheritance and Config.fields #55

samuelcolvin opened this issue Jun 30, 2017 · 0 comments

Comments

@samuelcolvin
Copy link
Owner

@samuelcolvin 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 error with inheritance and Config.fields 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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant