Skip to content

Commit f714c66

Browse files
Merge pull request #148 from stac-utils/patch/update-base-model-for-Asset
use StacBaseModel model instead of StacCommonMetadata
2 parents 5951230 + dd7b725 commit f714c66

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

Diff for: CHANGELOG.txt

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Fix STAC API Query Extension operator names from ne->neq, le->lte, and ge->gte (#120, @philvarner)
1111
- Better **datetime** parsing/validation by using Pydantic native types and remove `ciso8601` requirement (#131, @eseglem)
1212
- move datetime validation in `StacCommonMetadata` model definition (#131, @eseglem)
13+
- use `StacBaseModel` as base model for `Asset` model (#148, @vincentsarago)
1314
- add `license` in `StacCommonMetadata` model (#147, @vincentsarago)
1415

1516
3.0.0 (2024-01-25)

Diff for: stac_pydantic/shared.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def validate_start_end(self) -> Self:
173173
return self
174174

175175

176-
class Asset(StacCommonMetadata):
176+
class Asset(StacBaseModel):
177177
"""
178178
https://github.com/radiantearth/stac-spec/blob/v1.0.0/item-spec/item-spec.md#asset-object
179179
"""
@@ -187,10 +187,3 @@ class Asset(StacCommonMetadata):
187187
model_config = ConfigDict(
188188
populate_by_name=True, use_enum_values=True, extra="allow"
189189
)
190-
191-
@model_validator(mode="after")
192-
def validate_datetime_or_start_end(self) -> Self:
193-
# Overriding the parent method to avoid requiring datetime or start/end_datetime
194-
# Additional fields MAY be added on the Asset object, but are not required.
195-
# https://github.com/radiantearth/stac-spec/blob/v1.0.0/item-spec/item-spec.md#additional-fields-for-assets
196-
return self

0 commit comments

Comments
 (0)