Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions stapi-fastapi/src/stapi_fastapi/conformance.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CORE = "https://stapi.example.com/v0.1.0/core"
OPPORTUNITIES = "https://stapi.example.com/v0.1.0/opportunities"
ASYNC_OPPORTUNITIES = "https://stapi.example.com/v0.1.0/async-opportunities"
from stapi_pydantic.constants import STAPI_VERSION

CORE = f"https://stapi.example.com/v{STAPI_VERSION}/core"
OPPORTUNITIES = f"https://stapi.example.com/v{STAPI_VERSION}/opportunities"
ASYNC_OPPORTUNITIES = f"https://stapi.example.com/v{STAPI_VERSION}/async-opportunities"
4 changes: 4 additions & 0 deletions stapi-pydantic/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

## [Unreleased]

### Added

- `stapi_type` and `stapi_version` ([#54](https://github.com/stapi-spec/pystapi/pull/54))

## [0.0.2] - 2025-04-02

### Changed
Expand Down
2 changes: 2 additions & 0 deletions stapi-pydantic/src/stapi_pydantic/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
STAPI_VERSION = "0.1.0"
"""The default STAPI version for this library."""
3 changes: 3 additions & 0 deletions stapi-pydantic/src/stapi_pydantic/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
field_validator,
)

from .constants import STAPI_VERSION
from .datetime_interval import DatetimeInterval
from .filter import CQL2Filter
from .opportunity import OpportunityProperties
Expand Down Expand Up @@ -84,6 +85,8 @@ class Order[T: OrderStatus](_GeoJsonBase):
# retrieve them via the API
id: StrictStr
type: Literal["Feature"] = "Feature"
stapi_type: Literal["Order"] = "Order"
stapi_version: str = STAPI_VERSION

geometry: Geometry = Field(...)
properties: OrderProperties[T] = Field(...)
Expand Down
5 changes: 4 additions & 1 deletion stapi-pydantic/src/stapi_pydantic/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from pydantic import AnyHttpUrl, BaseModel, Field

from .constants import STAPI_VERSION
from .shared import Link

type Constraints = BaseModel
Expand All @@ -28,7 +29,9 @@ def __init__(self, url: AnyHttpUrl | str, **kwargs: Any) -> None:


class Product(BaseModel):
type_: Literal["Product"] = Field(default="Product", alias="type")
type_: Literal["Collection"] = Field(default="Collection", alias="type")
stapi_type: Literal["Product"] = "Product"
stapi_version: str = STAPI_VERSION
conformsTo: list[str] = Field(default_factory=list)
id: str
title: str = ""
Expand Down