-
-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Currently resources must define a schemas : list[str] attribute and assign a list with the schema.
This is not ideal, and there is no check performed on the schema attribute at the moment. FoobarResource.model_validate(payload) should raise an exception if payload["schemas"] does not contain the FoobarResource schema.
A solution can be to add a convention when building custom resources, say a __schema_urn__ classvar attribute, and then make Resource.schemas a computed attribute. The value of Resource.schemas could be generated by collecting the resource schema and the extensions schemas.
I cannot find a unambiguous sentence in the RFCs indicating that schemas is read-only, but it feels like this is just generated by the server and that it should not be editable by clients. For instance, in RFC7644 §3.5.2:
If one of the PATCH
operations modifies the "schemas" attribute, subsequent operations
SHALL assume the modified state of the "schemas" attribute. Clients
MAY implicitly modify the "schemas" attribute by adding (or
replacing) an attribute with its fully qualified name, including
schema URN. For example, adding the attribute "urn:ietf:params:scim:
schemas:extension:enterprise:2.0:User:employeeNumber" automatically
adds the value
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" to the
resource's "schemas" attribute.
one of the PATCH operations modifies the "schemas" attribute is ambiguous, is it about directly modifying the schemas attribute, or indirectly modifying it by adding/removing extension values?