Skip to content

feat: Adjust the PatchOp model #94

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Meow-Knight
Copy link

Enhance the PatchOp model with stricter validation and include two new contexts for the Patch action.

>>> from scim2_models.rfc7644.patch_op import PatchOp
>>> patch_instance = PatchOp.model_validate(dict(schemas=["abcd1234", "1234abcd"]))
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "D:\Bohi\scim2-models\scim2_models\base.py", line 808, in model_validate
    return super().model_validate(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Bohi\scim2-models\venv\Lib\site-packages\pydantic\main.py", line 703, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 2 validation errors for PatchOp
schemas
  Value error, `schemas` must be exactly ['urn:ietf:params:scim:api:messages:2.0:PatchOp'] [type=value_error, input_value=['abcd1234', '1234abcd'], input_type=list]
    For further information visit https://errors.pydantic.dev/2.11/v/value_error
operations
  Field required [type=missing, input_value={'schemas': ['abcd1234', '1234abcd']}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing

@Meow-Knight
Copy link
Author

Hi @azmeuk I opened this PR for the issue. Please help me review it.
One more thing I’d like to mention: one test case failed after my changes:
image

Do you have any thoughts on this?
Should I go ahead and update the test case as well?

@Meow-Knight Meow-Knight force-pushed the feat/adjust_patch_model branch from c2f5dad to 0f1e618 Compare May 28, 2025 04:04
@Meow-Knight Meow-Knight force-pushed the feat/adjust_patch_model branch from 0f1e618 to 5aba7b8 Compare June 2, 2025 09:51
@Meow-Knight
Copy link
Author

@azmeuk I just corrected my PR and it passed all the checks. Please help me review it. Thanks

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.

1 participant