tmilos / scim-schema

SCIM schema PHP library
MIT License
14 stars 8 forks source link

Validator doesn't work with schema extensions correctly #9

Closed ostrolucky closed 1 month ago

ostrolucky commented 1 month ago

When using schema extensions like so

(new SchemaValidator())->validate($content, $userSchema, [$enterpriseUserSchema, $customUserSchema]);

it seems validator doesn't seem to bother checking if attributes are defined in extensions. Once any attribute is defined in $userSchema, it will add a validation error, having errors like so

[xxx] Attribute is not defined [urn:ietf:params:scim:schemas:core:2.0:User]

even though attribute is defined by extension.

I would suggest to either remove validation error if during validation of extensions it turns out attributes are there, or merge attributes from all schemas together and validate that in one go.

ostrolucky commented 1 month ago

Ok so this was misunderstanding on my part. From RFC 7643:

the schema extension URI SHALL be used as a JSON container to distinguish attributes belonging to the extension namespace from base schema attributes