-
Notifications
You must be signed in to change notification settings - Fork 0
Update version to 2.1.33 and add FraudFundsTransferRequest, Frau… #403
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
Open
rcabrera-py
wants to merge
5
commits into
main
Choose a base branch
from
feat/add-transfer-fraud-models
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8f8e720
Update version to 2.1.31.dev0 and add FraudFundsTransferRequest, Frau…
rcabrera-py 025c405
Refactor FraudFundsTransferRequest and FraudFundsTransferResultEvent …
rcabrera-py c73f055
Update version to 2.1.32.dev2 and refactor FraudFundsTransferRequest …
rcabrera-py 319379b
Refactor FraudFundsTransferRequest to make reason and request_id requ…
rcabrera-py 15736df
Add FraudFundsTransferQuery class and update imports in __init__.py a…
rcabrera-py File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = '2.1.32' | ||
| __version__ = '2.1.33.dev0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
In Pydantic v2.10.5, canField(discriminator="event_type")withLiteral-based union variants enforce event-specific required fields without a custom@model_validator?💡 Result:
Yes, in Pydantic v2.10.5, using Field(discriminator="event_type") with Literal-based union variants automatically enforces event-specific required fields without needing a custom
@model_validator[1][2]. When you define a discriminated union, Pydantic uses the discriminator field to identify which specific model in the Union should be used for validation [1]. Once the correct variant is selected, Pydantic validates the input data against that specific model's schema, which includes enforcing all required fields defined within that variant [1][2]. If the input data contains the correct discriminator tag but is missing fields required by the selected model, Pydantic will raise a ValidationError identifying the missing fields for that specific variant [1][2]. Example: from typing import Literal, Union from pydantic import BaseModel, Field class EventA(BaseModel): event_type: Literal["A"] required_a: str class EventB(BaseModel): event_type: Literal["B"] required_b: int class Container(BaseModel): event: Union[EventA, EventB] = Field(discriminator="event_type") # This will raise a ValidationError because 'required_a' is missing for EventA Container.model_validate({"event": {"event_type": "A"}}) # This will succeed Container.model_validate({"event": {"event_type": "A", "required_a": "data"}})Citations:
🏁 Script executed:
Repository: cuenca-mx/cuenca-validations
Length of output: 3850
Replace manual event payload validation with a discriminated union model.
validate_payloadimplements variant-required fields that Pydantic v2.10.5 already supports viaLiteral+ discriminator-based unions. Pydantic'sField(discriminator="event_type")with separate event model variants automatically enforces event-specific required fields without custom validators, improving schema validation and error clarity.Per the mandatory coding guideline "Use built-in Pydantic validators," replace this custom
@model_validatorwith discriminated union variants (e.g., separateSucceededEventandFailedEventmodels) that define required fields as non-optional per event type.🤖 Prompt for AI Agents