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

failed to use SkipValidation in nested models #7385

Closed
sydney-runkle opened this issue Sep 9, 2023 Discussed in #7373 · 1 comment
Closed

failed to use SkipValidation in nested models #7385

sydney-runkle opened this issue Sep 9, 2023 Discussed in #7373 · 1 comment
Assignees
Labels
bug V2 Bug related to Pydantic V2

Comments

@sydney-runkle
Copy link
Member

Discussed in #7373

Originally posted by birdca September 8, 2023
I was trying to use SkipValidation like this:

class ModelA(BaseModel):
    pass

class ModelB(BaseModel):
    a: ModelA
    pass

class ModelC(BaseModel):
    b: list[SkipValidation[ModelB]]
    pass

but i get

pydantic_core._pydantic_core.SchemaError: Invalid Schema:
function-after.schema.model.schema.model-fields.fields.b.schema.list.items_schema.any.serialization
  Input tag 'definition-ref' found using 'type' does not match any of the expected tags: 'none', 'int', 'bool', 'float', 'str', 'bytes', 'bytearray', 'list', 'tuple', 'set', 'frozenset', 'generator', 'dict', 'datetime', 'date', 'time', 'timedelta', 'url', 'multi-host-url', 'json', 'uuid', 'function-plain', 'function-wrap', 'format', 'to-string', 'model' [type=union_tag_invalid, input_value={'type': 'definition-ref'...ModelB:140286906022960'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/union_tag_invalid

Wondering how to skip validation for b field?

@sydney-runkle sydney-runkle added the bug V2 Bug related to Pydantic V2 label Sep 9, 2023
@pydantic-hooky pydantic-hooky bot added the unconfirmed Bug not yet confirmed as valid/applicable label Sep 9, 2023
@sydney-runkle sydney-runkle self-assigned this Sep 9, 2023
@sydney-runkle
Copy link
Member Author

fixed by #7381

@sydney-runkle sydney-runkle removed the unconfirmed Bug not yet confirmed as valid/applicable label Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V2 Bug related to Pydantic V2
Projects
None yet
Development

No branches or pull requests

2 participants