Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STAC API fixes #908

Merged
merged 3 commits into from
Oct 7, 2023
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
29 changes: 19 additions & 10 deletions pycsw/stac/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@


CONFORMANCE_CLASSES = [
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-common-2/1.0/conf/collections',
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/queryables',
'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/queryables-query-parameters',
'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/filter',
'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/features-filter',
'http://www.opengis.net/spec/ogcapi-features-4/1.0/conf/create-replace-delete',
'http://www.opengis.net/spec/cql2/1.0/conf/cql2-json',
'http://www.opengis.net/spec/cql2/1.0/conf/cql2-text',
'https://api.stacspec.org/v1.0.0/core',
'https://api.stacspec.org/v1.0.0/ogcapi-features',
'https://api.stacspec.org/v1.0.0/item-search',
Expand Down Expand Up @@ -134,7 +144,7 @@ def landing_page(self, headers_, args):
'href': f"{self.config['server']['url']}/queryables"
}, {
'rel': 'search',
'type': 'application/json',
'type': 'application/geo+json',
'href': f"{self.config['server']['url']}/search"
}
]
Expand Down Expand Up @@ -174,12 +184,11 @@ def conformance(self, headers_, args):
headers_['Content-Type'] = 'application/json'
headers_['Accept'] = 'application/json'

headers, status, response = super().conformance(headers_, args)
response2 = json.loads(response)

response2['conformsTo'].extend(CONFORMANCE_CLASSES)
response = {
'conformsTo': CONFORMANCE_CLASSES
}

return self.get_response(200, headers_, response2)
return self.get_response(200, headers_, response)

def collections(self, headers_, args):
"""
Expand Down Expand Up @@ -248,7 +257,7 @@ def collections(self, headers_, args):
}, {
'rel': 'root',
'type': 'application/json',
'href': self.config['server']['url']
'href': f"{self.config['server']['url']}/"
}, {
'rel': 'parent',
'type': 'application/json',
Expand Down Expand Up @@ -291,7 +300,7 @@ def collection(self, headers_, args, collection='metadata:main'):
}, {
'rel': 'root',
'type': 'application/json',
'href': self.config['server']['url']
'href': f"{self.config['server']['url']}/"
}, {
'rel': 'parent',
'type': 'application/json',
Expand Down Expand Up @@ -354,7 +363,7 @@ def items(self, headers_, json_post_data, args, collection='metadata:main'):
}, {
'rel': 'root',
'type': 'application/json',
'href': self.config['server']['url']
'href': f"{self.config['server']['url']}/"
}, {
'rel': 'parent',
'type': 'application/json',
Expand All @@ -371,7 +380,7 @@ def items(self, headers_, json_post_data, args, collection='metadata:main'):
response2['links'].extend([{
'rel': 'root',
'type': 'application/json',
'href': self.config['server']['url']
'href': f"{self.config['server']['url']}/"
}
])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_landing_page(config):

assert content['stac_version'] == '1.0.0'
assert content['type'] == 'Catalog'
assert len(content['conformsTo']) == 4
assert len(content['conformsTo']) == 14
assert len(content['keywords']) == 3


Expand All @@ -70,7 +70,7 @@ def test_conformance(config):
assert headers['Content-Type'] == 'application/json'
assert status == 200

assert len(content['conformsTo']) == 18
assert len(content['conformsTo']) == 14

conformances = [
'https://api.stacspec.org/v1.0.0/core',
Expand Down
Loading