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

feat: add ignore_validators flag #28

Closed

Conversation

ADR-007
Copy link

@ADR-007 ADR-007 commented Feb 26, 2024

Take Annotated into account when ignore_validators=False

I believe this field ignore_validators should be False by default.
This is a for this issue

class SomethingListWithAnnotatedMinItems(PartialModelMixin, pydantic.BaseModel):
    items: Annotated[list[Something], MinLen(1)]

Before:
# SomethingListWithAnnotatedMinItems.as_partial() -> items: Optional[ist[Something]]

Now:
# SomethingListWithAnnotatedMinItems.as_partial() -> items: Optional[Annotated[list[Something], MinLen(1)]]

Take Annotated into account when ignore_validators=False
@ddanier
Copy link
Member

ddanier commented Mar 28, 2024

My initial feeling would be this is a great addition. Need to play with this a little bit :)

@ddanier
Copy link
Member

ddanier commented Apr 22, 2024

@ADR-007 Sorry for the delayed reply.

I see two major issues with the PR:

I would argue that having this PR merged would only increase the confusion around validators at the moment. We need to have a complete solution handling those.

Would you be willing to extend the PR to also contain this?

@ADR-007
Copy link
Author

ADR-007 commented Apr 23, 2024

Thank you for that detailed code review!

It seems to be much easier in my case to support Pydantic v2 only, as I described it here. We can close this PR :)

@ADR-007 ADR-007 closed this Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants