scimmy
scimmy copied to clipboard
Complex value gives error response if unknown sub-attribute is sent
If we disable the name.honorificPrefix
field from the user definition (SCIMMY.Schemas.User.definition.truncate('name.honorificPrefix')
) and then send data that contains that field, such as:
{
"addresses" : [ {
"country" : "Philippines",
"streetAddress" : "870 McLaughlin Turnpike",
"formatted" : "Suite 431 1780 Albert Green, Holliefort, NE 20440-9954",
"postalCode" : "40331",
"locality" : "Tanikaport",
"primary" : true
} ],
"displayName" : "Lavonda Runolfsdottir",
"nickName" : "Sherman Wadd Evver",
"externalId" : "travis.spinka",
"active" : true,
"userName" : "elenafadel",
"title" : "Forward Creative Director",
"phoneNumbers" : [ {
"value" : "818-532-0271",
"primary" : true
} ],
"emails" : [ {
"value" : "[email protected]",
"primary" : true
} ],
"password" : "garth.yost",
"schemas" : [ "urn:ietf:params:scim:schemas:core:2.0:User"],
"name" : {
"formatted" : "Cathrine Gleason",
"familyName" : "Becker",
"givenName" : "Jacklyn",
"honorificPrefix" : "Mrs."
}
}
We will get a 400 error: {"schemas":["urn:ietf:params:scim:api:messages:2.0:Error"],"status":"400","scimType":"invalidValue","detail":"Complex attribute 'name' does not declare subAttribute 'honorificPrefix'"}
We should instead ignore such fields, just as we do when specifying SCIMMY.Schemas.User.definition.truncate('phoneNumbers')
, which gives a 200 response for the input above.
I am not sure how to fix this myself, but it likely involves updating https://github.com/scimmyjs/scimmy/blob/8a25458fbc122e27d6b65cf52a91bdd0d140a62d/src/lib/types/attribute.js#L581 and the tests.