Skip to content

Commit 5f0de7d

Browse files
authored
fix: pydantic regex (#43)
1 parent df6b91d commit 5f0de7d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tests/test_ulid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class Model(BaseModel):
243243
assert {
244244
"maxLength": 26,
245245
"minLength": 26,
246-
"pattern": "[A-Z0-9]{26}",
246+
"pattern": "[01234567][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{25}",
247247
"type": "string",
248248
} in model_json_schema["properties"]["ulid"]["anyOf"]
249249
assert {

ulid/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def __get_pydantic_core_schema__(cls, source: Any, handler: GetCoreSchemaHandler
297297
core_schema.union_schema([
298298
core_schema.is_instance_schema(ULID),
299299
core_schema.no_info_plain_validator_function(ULID),
300-
core_schema.str_schema(pattern=r"[A-Z0-9]{26}", min_length=26, max_length=26),
300+
core_schema.str_schema(pattern=r"[01234567][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{25}", min_length=26, max_length=26),
301301
core_schema.bytes_schema(min_length=16, max_length=16),
302302
]),
303303
serialization=core_schema.to_string_ser_schema(

0 commit comments

Comments
 (0)