Skip to content

PATCH operations fail on multi-valued primitive attributes (e.g., list[str]) #17

@vishmahajan

Description

@vishmahajan

scim2-models supports defining multi-valued primitive fields on extensions (e.g., list[str] | None), and the tutorial documents this as valid. However, scim2-server's PATCH operators crash when processing these fields because parse_new_value and model_validate_from_dict assume the field's root type is always a BaseModel subclass.

Reproduction:
Define an extension with a multi-valued primitive:

  class MyExtension(Extension):
      tags: list[str] | None = None

PATCH replace with a list of strings:

  {                                                                    
    "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
    "Operations": [                                                                                                           
      {
        "op": "replace",                                                                                                      
        "path": "urn:example:schemas:MyExtension:tags",                
        "value": ["tag1", "tag2"]                                                                                             
      }
    ]                                                                                                                         
  }                        

Result: 400 invalidValue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions