Skip to content

Commit 7a97d6c

Browse files
authored
Update to 1.0.0-beta.4 (#298)
* Add beta4 conformance classes and suggested docs url * Remove old docs link * Add test for service-doc * Remove println * Update changelog
1 parent d5c9d6c commit 7a97d6c

File tree

13 files changed

+58
-34
lines changed

13 files changed

+58
-34
lines changed

CHANGES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44

55
### Added
66

7+
* Add link with rel-type of 'service-doc', pointing to HTML API documentation ([#298](https://github.com/stac-utils/stac-fastapi/pull/298))
8+
79
### Changed
810

911
* Refactor to remove hardcoded search request models. Request models are now dynamically created based on the enabled extensions.
1012
([#213](https://github.com/stac-utils/stac-fastapi/pull/213))
1113
* Change example data to use correct `type` for the example Joplin collection ([#314](https://github.com/stac-utils/stac-fastapi/pull/314))
1214
* Changed the geometry type in the Item model from Polygon to Geometry.
13-
* Upgrade pgstac backend to use version 0.4.3 ([#321](https://github.com/stac-utils/stac-fastapi/pull/321))
15+
* Upgrade pgstac backend to use version 0.4.2 ([#321](https://github.com/stac-utils/stac-fastapi/pull/321))
16+
* STAC 1.0.0-beta.4 conformance classes updated ([#298](https://github.com/stac-utils/stac-fastapi/pull/298))
17+
* Upgrade pgstac backend to use version 0.4.3 ([#326](https://github.com/stac-utils/stac-fastapi/pull/326))
1418

1519
### Removed
1620

stac_fastapi/api/stac_fastapi/api/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ class StacApi:
6565
)
6666
app: FastAPI = attr.ib(
6767
default=attr.Factory(
68-
lambda self: FastAPI(openapi_url=self.settings.openapi_url),
68+
lambda self: FastAPI(
69+
openapi_url=self.settings.openapi_url,
70+
docs_url=self.settings.docs_url,
71+
redoc_url=None,
72+
),
6973
takes_self=True,
7074
),
7175
converter=update_openapi,

stac_fastapi/extensions/stac_fastapi/extensions/core/context.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ class ContextExtension(ApiExtension):
1818
"""
1919

2020
conformance_classes: List[str] = attr.ib(
21-
factory=lambda: ["https://api.stacspec.org/v1.0.0-beta.3/item-search/#context"]
21+
factory=lambda: ["https://api.stacspec.org/v1.0.0-beta.4/item-search/#context"]
2222
)
2323
schema_href: Optional[str] = attr.ib(
24-
default="https://raw.githubusercontent.com/radiantearth/stac-api-spec/v1.0.0-beta.3/fragments/context/json-schema/schema.json"
24+
default="https://raw.githubusercontent.com/radiantearth/stac-api-spec/v1.0.0-beta.4/fragments/context/json-schema/schema.json"
2525
)
2626

2727
def register(self, app: FastAPI) -> None:

stac_fastapi/extensions/stac_fastapi/extensions/core/fields/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class FieldsExtension(ApiExtension):
3030
POST = FieldsExtensionPostRequest
3131

3232
conformance_classes: List[str] = attr.ib(
33-
factory=lambda: ["https://api.stacspec.org/v1.0.0-beta.3/item-search/#fields"]
33+
factory=lambda: ["https://api.stacspec.org/v1.0.0-beta.4/item-search/#fields"]
3434
)
3535
default_includes: Set[str] = attr.ib(
3636
factory=lambda: {

stac_fastapi/extensions/stac_fastapi/extensions/core/filter/filter.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@
1818
class FilterConformanceClasses(str, Enum):
1919
"""Conformance classes for the Filter extension.
2020
21-
See https://github.com/radiantearth/stac-api-spec/tree/v1.0.0-beta.3/fragments/filter
21+
See https://github.com/radiantearth/stac-api-spec/tree/v1.0.0-beta.4/fragments/filter
2222
"""
2323

24-
FILTER = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:filter"
24+
FILTER = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:filter"
2525
ITEM_SEARCH_FILTER = (
26-
"https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:item-search-filter"
26+
"https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:item-search-filter"
2727
)
28-
CQL_TEXT = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:cql-text"
29-
CQL_JSON = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:cql-json"
30-
BASIC_CQL = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:basic-cql"
31-
BASIC_SPATIAL_OPERATORS = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:basic-spatial-operators"
32-
BASIC_TEMPORAL_OPERATORS = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:basic-temporal-operators"
33-
ENHANCED_COMPARISON_OPERATORS = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:enhanced-comparison-operators"
34-
ENHANCED_SPATIAL_OPERATORS = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:enhanced-spatial-operators"
35-
ENHANCED_TEMPORAL_OPERATORS = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:enhanced-temporal-operators"
36-
FUNCTIONS = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:functions"
37-
ARITHMETIC = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:arithmetic"
38-
ARRAYS = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:arrays"
39-
QUERYABLE_SECOND_OPERAND = "https://api.stacspec.org/v1.0.0-beta.3/item-search#filter:queryable-second-operand"
28+
CQL_TEXT = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:cql-text"
29+
CQL_JSON = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:cql-json"
30+
BASIC_CQL = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:basic-cql"
31+
BASIC_SPATIAL_OPERATORS = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:basic-spatial-operators"
32+
BASIC_TEMPORAL_OPERATORS = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:basic-temporal-operators"
33+
ENHANCED_COMPARISON_OPERATORS = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:enhanced-comparison-operators"
34+
ENHANCED_SPATIAL_OPERATORS = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:enhanced-spatial-operators"
35+
ENHANCED_TEMPORAL_OPERATORS = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:enhanced-temporal-operators"
36+
FUNCTIONS = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:functions"
37+
ARITHMETIC = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:arithmetic"
38+
ARRAYS = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:arrays"
39+
QUERYABLE_SECOND_OPERAND = "https://api.stacspec.org/v1.0.0-beta.4/item-search#filter:queryable-second-operand"
4040

4141

4242
@attr.s

stac_fastapi/extensions/stac_fastapi/extensions/core/query/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class QueryExtension(ApiExtension):
2323
POST = QueryExtensionPostRequest
2424

2525
conformance_classes: List[str] = attr.ib(
26-
factory=lambda: ["https://api.stacspec.org/v1.0.0-beta.3/item-search/#query"]
26+
factory=lambda: ["https://api.stacspec.org/v1.0.0-beta.4/item-search/#query"]
2727
)
2828
schema_href: Optional[str] = attr.ib(default=None)
2929

stac_fastapi/extensions/stac_fastapi/extensions/core/sort/sort.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class SortExtension(ApiExtension):
2323
POST = SortExtensionPostRequest
2424

2525
conformance_classes: List[str] = attr.ib(
26-
factory=lambda: ["https://api.stacspec.org/v1.0.0-beta.3/item-search/#sort"]
26+
factory=lambda: ["https://api.stacspec.org/v1.0.0-beta.4/item-search/#sort"]
2727
)
2828
schema_href: Optional[str] = attr.ib(default=None)
2929

stac_fastapi/extensions/stac_fastapi/extensions/core/transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class TransactionExtension(ApiExtension):
3838
settings: ApiSettings = attr.ib()
3939
conformance_classes: List[str] = attr.ib(
4040
factory=lambda: [
41-
"https://api.stacspec.org/v1.0.0-beta.3/ogcapi-features/extensions/transaction/",
41+
"https://api.stacspec.org/v1.0.0-beta.4/ogcapi-features/extensions/transaction/",
4242
"http://www.opengis.net/spec/ogcapi-features-4/1.0/conf/simpletx",
4343
]
4444
)

stac_fastapi/pgstac/tests/resources/test_conformance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_landing_page_health(response):
3333
link_tests = [
3434
("root", "application/json", "/"),
3535
("conformance", "application/json", "/conformance"),
36-
("docs", "application/json", "/docs"),
36+
("service-doc", "text/html", "/api.html"),
3737
("service-desc", "application/vnd.oai.openapi+json;version=3.0", "/api"),
3838
]
3939

stac_fastapi/sqlalchemy/tests/resources/test_conformance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_landing_page_health(response):
3333
link_tests = [
3434
("root", "application/json", "/"),
3535
("conformance", "application/json", "/conformance"),
36-
("docs", "application/json", "/docs"),
36+
("service-doc", "text/html", "/api.html"),
3737
("service-desc", "application/vnd.oai.openapi+json;version=3.0", "/api"),
3838
]
3939

stac_fastapi/types/stac_fastapi/types/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ApiSettings(BaseSettings):
2727
enable_response_models: bool = False
2828

2929
openapi_url: str = "/api"
30+
docs_url: str = "/api.html"
3031

3132
class Config:
3233
"""model config (https://pydantic-docs.helpmanual.io/usage/model_config/)."""

stac_fastapi/types/stac_fastapi/types/conformance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
class STACConformanceClasses(str, Enum):
66
"""Conformance classes for the STAC API spec."""
77

8-
CORE = "https://api.stacspec.org/v1.0.0-beta.3/core"
9-
OGC_API_FEAT = "https://api.stacspec.org/v1.0.0-beta.3/ogcapi-features"
10-
ITEM_SEARCH = "https://api.stacspec.org/v1.0.0-beta.3/item-search"
8+
CORE = "https://api.stacspec.org/v1.0.0-beta.4/core"
9+
OGC_API_FEAT = "https://api.stacspec.org/v1.0.0-beta.4/ogcapi-features"
10+
ITEM_SEARCH = "https://api.stacspec.org/v1.0.0-beta.4/item-search"
1111

1212

1313
class OAFConformanceClasses(str, Enum):

stac_fastapi/types/stac_fastapi/types/core.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,6 @@ def _landing_page(
263263
"type": MimeTypes.json,
264264
"href": urljoin(base_url, "collections"),
265265
},
266-
{
267-
"rel": Relations.docs.value,
268-
"type": MimeTypes.json,
269-
"title": "OpenAPI docs",
270-
"href": urljoin(base_url, "docs"),
271-
},
272266
{
273267
"rel": Relations.conformance.value,
274268
"type": MimeTypes.json,
@@ -375,6 +369,17 @@ def landing_page(self, **kwargs) -> stac_types.LandingPage:
375369
"href": urljoin(base_url, request.app.openapi_url.lstrip("/")),
376370
}
377371
)
372+
373+
# Add human readable service-doc
374+
landing_page["links"].append(
375+
{
376+
"rel": "service-doc",
377+
"type": "text/html",
378+
"title": "OpenAPI service documentation",
379+
"href": urljoin(base_url, request.app.docs_url.lstrip("/")),
380+
}
381+
)
382+
378383
return landing_page
379384

380385
def conformance(self, **kwargs) -> stac_types.Conformance:
@@ -552,6 +557,16 @@ async def landing_page(self, **kwargs) -> stac_types.LandingPage:
552557
}
553558
)
554559

560+
# Add human readable service-doc
561+
landing_page["links"].append(
562+
{
563+
"rel": "service-doc",
564+
"type": "text/html",
565+
"title": "OpenAPI service documentation",
566+
"href": urljoin(base_url, request.app.docs_url.lstrip("/")),
567+
}
568+
)
569+
555570
return landing_page
556571

557572
async def conformance(self, **kwargs) -> stac_types.Conformance:

0 commit comments

Comments
 (0)