Skip to content

Commit 318116c

Browse files
authored
Replace PlainValidator -> BeforeValidator (#209)
1 parent 18bdc5c commit 318116c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/codegen/sdk/codebase/span.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Annotated, Any
22

3-
from pydantic import BaseModel, ConfigDict, PlainValidator, WithJsonSchema
3+
from pydantic import BaseModel, BeforeValidator, ConfigDict, WithJsonSchema
44
from pydantic.json_schema import JsonSchemaValue
55
from pydantic_core.core_schema import ValidationInfo
66
from tree_sitter import Point, Range
@@ -45,7 +45,7 @@ def range_json_schema() -> JsonSchemaValue:
4545

4646
RangeAdapter = Annotated[
4747
Range,
48-
PlainValidator(validate_range),
48+
BeforeValidator(validate_range),
4949
WithJsonSchema(range_json_schema()),
5050
]
5151

@@ -56,6 +56,7 @@ class Span(BaseModel):
5656

5757
model_config = ConfigDict(
5858
frozen=True,
59+
arbitrary_types_allowed=True,
5960
json_encoders={
6061
Range: lambda r: {
6162
"start_byte": r.start_byte,

0 commit comments

Comments
 (0)