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

submodel validation doesn't check the model is of the correct type #403

Closed
samuelcolvin opened this issue Feb 19, 2019 · 0 comments
Closed

submodel validation doesn't check the model is of the correct type #403

samuelcolvin opened this issue Feb 19, 2019 · 0 comments
Labels

Comments

@samuelcolvin
Copy link
Owner

@samuelcolvin samuelcolvin commented Feb 19, 2019

pydantic/pydantic/main.py

Lines 410 to 417 in 7cd423a

def validate(cls, value: Union['DictStrAny', 'BaseModel']) -> 'BaseModel':
if isinstance(value, dict):
return cls(**value)
elif isinstance(value, BaseModel):
return value.copy()
else:
with change_exception(DictError, TypeError, ValueError):
return cls(**dict(value))

as of #389 I think any model will be permitted to a submodel field.

samuelcolvin added a commit that referenced this issue Feb 25, 2019
@samuelcolvin samuelcolvin mentioned this issue Feb 25, 2019
3 of 4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant