Skip to content

Check the uniqueness of sub-attributes and multi-valued attributes - #59

Merged
azmeuk merged 1 commit into
mainfrom
subattribute-uniqueness
Nov 27, 2026
Merged

azmeuk merged 1 commit into
mainfrom
subattribute-uniqueness

Conversation

@azmeuk

@azmeuk azmeuk commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

A storage only checked the unique attributes at the top of a resource, and compared a multi-valued attribute as a whole. A unique value now belongs to one resource wherever it sits, such as emails.value in a model declaring it unique. Each value of a multi-valued attribute counts on its own, so ["a", "b"] and ["a"] now clash.

  • Per RFC 7643 erratum 8279, the check spans every resource type using the schema.
  • Two equal values in the same resource do not clash, and a value the stored resource already holds is not checked again.
  • A value clients never read, write-only or never returned, is not checked: a 409 would tell that another resource holds it. A mapping declaring such an attribute unique gets the hidden-unique error.
  • unique_values lists the unique values of a resource, with the form they are compared in. The in-memory storage uses it.
  • In the mapping core, _unique_attributes replaces _unique_columns. It returns the unique attributes clients read, whether the storage writes them or not: in the record, in an Entry, in the entries of a collection, or as the value of a Link. holds_any builds the condition that a record holds one of some values.

ScimStorageContract checks these rules on Mailbox resources, for a storage setting stores_mailboxes. The storage then serves the Mailbox and SharedMailbox resource types, which share a schema. The test backend of the mapping core passes it, and shows how a backend checks the values across its mappings.

Each value of a unique attribute belongs to one resource, at any depth, and each value of a multi-valued attribute counts on its own. Values clients never read are not checked, and a mapping refuses them.
@read-the-docs-community

Copy link
Copy Markdown

@azmeuk
azmeuk enabled auto-merge November 27, 2026 14:03
@azmeuk
azmeuk merged commit 84c76ae into main Nov 27, 2026
10 checks passed
@azmeuk
azmeuk deleted the subattribute-uniqueness branch November 27, 2026 14:06
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.

1 participant