Skip to content

Commit 632f60c

Browse files
committed
fixup! Allow constructing ULID from UUID
1 parent 67d8d52 commit 632f60c

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

tests/test_json_schema.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,12 @@
222222
{
223223
'properties': {
224224
'x': {
225-
'anyOf': [{'type': 'integer'}, {'format': 'binary', 'type': 'string'}, {'type': 'string'}],
225+
'anyOf': [
226+
{'type': 'integer'},
227+
{'format': 'binary', 'type': 'string'},
228+
{'type': 'string'},
229+
{'format': 'uuid', 'type': 'string'},
230+
],
226231
'title': 'X',
227232
}
228233
},

tests/test_ulid.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ def test_json_schema():
6666
assert Something.model_json_schema(mode='validation') == {
6767
'properties': {
6868
'ulid': {
69-
'anyOf': [{'type': 'integer'}, {'format': 'binary', 'type': 'string'}, {'type': 'string'}],
69+
'anyOf': [
70+
{'type': 'integer'},
71+
{'format': 'binary', 'type': 'string'},
72+
{'type': 'string'},
73+
{'format': 'uuid', 'type': 'string'},
74+
],
7075
'title': 'Ulid',
7176
}
7277
},
@@ -77,7 +82,12 @@ def test_json_schema():
7782
assert Something.model_json_schema(mode='serialization') == {
7883
'properties': {
7984
'ulid': {
80-
'anyOf': [{'type': 'integer'}, {'format': 'binary', 'type': 'string'}, {'type': 'string'}],
85+
'anyOf': [
86+
{'type': 'integer'},
87+
{'format': 'binary', 'type': 'string'},
88+
{'type': 'string'},
89+
{'format': 'uuid', 'type': 'string'},
90+
],
8191
'title': 'Ulid',
8292
}
8393
},

0 commit comments

Comments
 (0)