fix OAProc relation types (#846)

* [OAProc]: fix relation types (#845)

* [OAProc]: fix relation types (#845)
This commit is contained in:
Tom Kralidis
2022-01-25 06:42:09 -05:00
committed by GitHub
parent 300be49a58
commit 76fd56a671
3 changed files with 33 additions and 4 deletions
+31 -2
View File
@@ -2526,11 +2526,31 @@ class API:
p2['links'] = p2.get('links', [])
jobs_url = '{}/jobs'.format(self.config['server']['url'])
process_url = '{}/processes/{}'.format(
self.config['server']['url'], key)
# TODO translation support
link = {
'type': FORMAT_TYPES[F_JSON],
'rel': request.get_linkrel(F_JSON),
'href': '{}?f={}'.format(process_url, F_JSON),
'title': 'Process description as JSON',
'hreflang': self.default_locale
}
p2['links'].append(link)
link = {
'type': FORMAT_TYPES[F_HTML],
'rel': 'collection',
'rel': request.get_linkrel(F_HTML),
'href': '{}?f={}'.format(process_url, F_HTML),
'title': 'Process description as HTML',
'hreflang': self.default_locale
}
p2['links'].append(link)
link = {
'type': FORMAT_TYPES[F_HTML],
'rel': 'http://www.opengis.net/def/rel/ogc/1.0/job-list',
'href': '{}?f={}'.format(jobs_url, F_HTML),
'title': 'jobs for this process as HTML',
'hreflang': self.default_locale
@@ -2539,13 +2559,22 @@ class API:
link = {
'type': FORMAT_TYPES[F_JSON],
'rel': 'collection',
'rel': 'http://www.opengis.net/def/rel/ogc/1.0/job-list',
'href': '{}?f={}'.format(jobs_url, F_JSON),
'title': 'jobs for this process as JSON',
'hreflang': self.default_locale
}
p2['links'].append(link)
link = {
'type': FORMAT_TYPES[F_JSON],
'rel': 'http://www.opengis.net/def/rel/ogc/1.0/execute',
'href': '{}/execution?f={}'.format(process_url, F_JSON),
'title': 'Execution for this process as JSON',
'hreflang': self.default_locale
}
p2['links'].append(link)
processes.append(p2)
if process is not None:
+1 -1
View File
@@ -53,7 +53,7 @@ PROCESS_METADATA = {
'keywords': ['hello world', 'example', 'echo'],
'links': [{
'type': 'text/html',
'rel': 'canonical',
'rel': 'about',
'title': 'information',
'href': 'https://example.org/process',
'hreflang': 'en-US'
+1 -1
View File
@@ -1116,7 +1116,7 @@ def test_describe_processes(config, api_):
assert process['version'] == '0.2.0'
assert process['title'] == 'Hello World'
assert len(process['keywords']) == 3
assert len(process['links']) == 3
assert len(process['links']) == 6
assert len(process['inputs']) == 2
assert len(process['outputs']) == 1
assert len(process['outputTransmission']) == 1