feat: support multiple names per field in an identity - #8
Merged
Conversation
A service field may now hold a list of names, not just a scalar. Lookups
match any of the listed names, and answers return the whole list.
- `QueryService::whatIsTheNameOf` and `Identity::username` now return
`string|array|null`: a string for single-name fields, an array when the
asked service holds several, `null` for a miss.
- `YamlFileRepository` indexes every name under a field so a query by any
one of them resolves the identity; a scalar is treated as a one-element
list, keeping single-name data unchanged.
- The HTTP layer keeps its `{"username": ...}` envelope and 200/404 and
200/207 status semantics; the value simply widens to include a JSON array.
Backward compatible for single-name data. Documented in the README and a
new ADL. Note: `username` is now string-or-array, a widening of the API
contract that string-only clients must handle.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces multiple names per field in an identity. A service field may now hold a list of names instead of a single scalar:
other@example.orgornew@example.orgonemailresolves the same identity.Changes
QueryService::whatIsTheNameOf()andIdentity::username()now returnstring|array|null: a string for single-name fields, an array when the asked service holds several,nullfor a miss.whatAreTheNamesOf()(batch) returns an index-aligned list of those answers.YamlFileRepository::transformIdentityListToIndex()indexes every name under a field (foreach ((array) $value as $name)), so a query by any one of them resolves the identity. A scalar is treated as a one-element list, so single-name data is unchanged.null, so both the single (200/404) and batch (200/207) endpoints keep their{"username": ...}envelope; the value simply widens to include a JSON array.docs/adl/2026-07-08-multiple-names-per-field.md.Compatibility
usernameis now string-or-array. String-only clients (e.g. whose-name-client) must be updated before they consume multi-name fields.Testing
Full suite passes via
./vendor/bin/sail test— 32 passed, 1 skipped (pre-existing filesystem-atime skip). New tests cover the array response and search-by-any-entry across the domain, infrastructure, and application layers.🤖 Generated with Claude Code