Skip to content

Commit 275776c

Browse files
authored
Fix additional context inclusion (#2095)
* Update test_linked_data.py * Update linked_data.py
1 parent 2e203ed commit 275776c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pygeoapi/linked_data.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ def geojson2jsonld(cls, data: dict, dataset: str,
189189
"""
190190

191191
LOGGER.debug('Fetching context from resource configuration')
192-
context = cls.config['resources'][dataset].get('context', []).copy()
192+
linked_data = cls.config['resources'][dataset].get('linked-data', {})
193+
context = linked_data.get('context', []).copy()
193194
templates = cls.get_dataset_templates(dataset)
194195

195196
defaultVocabulary = {

tests/other/test_linked_data.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ def test_geojson2jsonld_single_feature(api_, feature):
6969
result_dict = json.loads(result)
7070

7171
assert '@context' in result_dict
72+
assert len(result_dict['@context']) == 2
73+
assert 'stn_id' in result_dict['@context'][1]
74+
7275
assert result_dict['@id'] == 'http://example.org/feature/1'
7376
assert 'schema:geo' in result_dict
7477

0 commit comments

Comments
 (0)