Skip to content

Commit

Permalink
add names props to ou id type
Browse files Browse the repository at this point in the history
  • Loading branch information
bender committed Jan 22, 2025
1 parent 135465b commit 862d306
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changes/e003e20f582783e46b6c266e15da502f.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
desc: Added ``names`` property and ``alts`` definitions to the ``ou:id:type`` form.
prs: []
type: model
...
3 changes: 3 additions & 0 deletions synapse/models/orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,11 @@ def getModelDefs(self):
'doc': 'The org which issues id numbers of this type.',
}),
('name', ('str', {}), {
'alts': ('names',),
'doc': 'The friendly name of the id number type.',
}),
('names', ('array', {'type': 'str', 'sorted': True, 'uniq': True}), {
'doc': 'An array of alternate names for the type.'}),
('url', ('inet:url', {}), {
'doc': 'The official URL of the issuer.',
}),
Expand Down
3 changes: 3 additions & 0 deletions synapse/tests/test_model_orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,9 @@ async def test_ou_simple(self):

iden = await core.callStorm('ou:id:type return($node.value())')

self.len(1, alts := await core.nodes('[ ou:id:type=({"name": "foobar"}) ]'))
self.eq(nodes[0].ndef, alts[0].ndef)

opts = {'vars': {'type': iden}}
nodes = await core.nodes('''
[ ou:id:number=($type, visi)
Expand Down

0 comments on commit 862d306

Please sign in to comment.