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

forbid extra fields in BaseModel #44306

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rawwar
Copy link
Collaborator

@rawwar rawwar commented Nov 23, 2024

As of now, we allow any fields to be in the Data Models. This PR ensures that requests have the exact required fields.

As of now, if we pass the wrong fields, the data models simply ignore them.

@pierrejeambrun , do you think this is a good idea?

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Nov 23, 2024
@rawwar rawwar changed the title forbids extra fields in DataModels forbids extra fields in BaseModel Nov 23, 2024
@rawwar rawwar changed the title forbids extra fields in BaseModel forbid extra fields in BaseModel Nov 23, 2024
pierrejeambrun
pierrejeambrun previously approved these changes Nov 25, 2024
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I think it's a good idea.

If a user PATCH "satte" instead of "state" this will give him an explicit message instead of accepting the PATCH request and basically ignoring the field, resulting in a silent error for the user.

It's worth fixing test and getting it ready to merge 👍

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Nov 25, 2024

Note: Add this to the breaking change of the API tracked here:
#43378

(We do not create the newsfragments yet, format is not settled for those).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants