From 7e0643b1f3d62898e4f7ebd51e22abf471f66e14 Mon Sep 17 00:00:00 2001 From: Jennings Anderson Date: Tue, 31 Mar 2026 08:51:56 -0700 Subject: [PATCH] Add bbox? --- .../src/overture/schema/core/models.py | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/packages/overture-schema-core/src/overture/schema/core/models.py b/packages/overture-schema-core/src/overture/schema/core/models.py index dbb77a281..7482b38c5 100644 --- a/packages/overture-schema-core/src/overture/schema/core/models.py +++ b/packages/overture-schema-core/src/overture/schema/core/models.py @@ -1,34 +1,20 @@ import textwrap from typing import Annotated, Generic, TypeVar -from pydantic import ( - BaseModel, - ConfigDict, - Field, - GetJsonSchemaHandler, - model_validator, -) -from pydantic.json_schema import JsonSchemaValue -from pydantic_core import core_schema -from typing_extensions import Self - from overture.schema.system.feature import Feature from overture.schema.system.field_constraint import UniqueItemsConstraint from overture.schema.system.model_constraint import no_extra_fields -from overture.schema.system.primitive import ( - Geometry, -) +from overture.schema.system.primitive import BBox, Geometry from overture.schema.system.ref import Id, Identified -from overture.schema.system.string import ( - CountryCodeAlpha2, -) +from overture.schema.system.string import CountryCodeAlpha2 +from pydantic import BaseModel, ConfigDict, Field, GetJsonSchemaHandler, model_validator +from pydantic.json_schema import JsonSchemaValue +from pydantic_core import core_schema +from typing_extensions import Self from .enums import PerspectiveMode from .sources import Sources -from .types import ( - FeatureVersion, - Level, -) +from .types import FeatureVersion, Level ThemeT = TypeVar("ThemeT", bound=str) TypeT = TypeVar("TypeT", bound=str) @@ -49,6 +35,7 @@ class OvertureFeature(Identified, Feature, Generic[ThemeT, TypeT]): # this is an enum in the JSON Schema, but that prevents OvertureFeature from being extended type: TypeT geometry: Geometry + bbox: BBox version: FeatureVersion # Optional @@ -86,12 +73,14 @@ def __get_pydantic_json_schema__( properties_object_schema = json_schema["properties"]["properties"] properties_object_schema["patternProperties"] = { "^ext_.*$": { - "description": textwrap.dedent(""" + "description": textwrap.dedent( + """ Additional top-level properties are allowed if prefixed by `ext_`. This feature is a on a deprecation path and will be removed once the schema is fully migrated to Pydantic. - """).strip(), + """ + ).strip(), } } properties_object_schema["additionalProperties"] = False