Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/codegen/sdk/codebase/span.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Annotated, Any

from pydantic import BaseModel, ConfigDict, PlainValidator, WithJsonSchema
from pydantic import BaseModel, BeforeValidator, ConfigDict, WithJsonSchema
from pydantic.json_schema import JsonSchemaValue
from pydantic_core.core_schema import ValidationInfo
from tree_sitter import Point, Range
Expand Down Expand Up @@ -45,7 +45,7 @@ def range_json_schema() -> JsonSchemaValue:

RangeAdapter = Annotated[
Range,
PlainValidator(validate_range),
BeforeValidator(validate_range),
WithJsonSchema(range_json_schema()),
]

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

model_config = ConfigDict(
frozen=True,
arbitrary_types_allowed=True,
json_encoders={
Range: lambda r: {
"start_byte": r.start_byte,
Expand Down