Skip to content

Conversation

@Meow-Knight
Copy link
Contributor

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
Contributor 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
Contributor Author

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

@azmeuk azmeuk merged commit 70bfc68 into python-scim:main Jul 10, 2025
20 checks passed
@azmeuk
Copy link
Contributor

azmeuk commented Jul 10, 2025

Thank you for your contribution!

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