diff --git a/pygeoapi/api/coverages.py b/pygeoapi/api/coverages.py index 7761bd583..01e5638a6 100644 --- a/pygeoapi/api/coverages.py +++ b/pygeoapi/api/coverages.py @@ -200,14 +200,14 @@ def get_collection_coverage( return api.get_format_exception(request) -def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: +def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, dict]]: # noqa """ Get OpenAPI fragments :param cfg: `dict` of configuration :param locale: `str` of locale - :returns: `tuple` of `list` of tags and `dict` of path objects + :returns: `tuple` of `list` of tag objects, and `dict` of path objects """ from pygeoapi.openapi import OPENAPI_YAML, get_visible_collections @@ -250,4 +250,4 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: } } - return [], {'paths': paths} + return [{'name': 'coverages'}], {'paths': paths} diff --git a/pygeoapi/api/environmental_data_retrieval.py b/pygeoapi/api/environmental_data_retrieval.py index 9ffe0c116..f659cc835 100644 --- a/pygeoapi/api/environmental_data_retrieval.py +++ b/pygeoapi/api/environmental_data_retrieval.py @@ -206,14 +206,14 @@ def get_collection_edr_query(api: API, request: APIRequest, return headers, HTTPStatus.OK, content -def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: +def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, dict]]: # noqa """ Get OpenAPI fragments :param cfg: `dict` of configuration :param locale: `str` of locale - :returns: `tuple` of `list` of tags and `dict` of path objects + :returns: `tuple` of `list` of tag objects, and `dict` of path objects """ from pygeoapi.openapi import OPENAPI_YAML, get_visible_collections @@ -329,4 +329,4 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: } } - return [], {'paths': paths} + return [{'name': 'edr'}], {'paths': paths} diff --git a/pygeoapi/api/itemtypes.py b/pygeoapi/api/itemtypes.py index fb5e730f4..4a746067b 100644 --- a/pygeoapi/api/itemtypes.py +++ b/pygeoapi/api/itemtypes.py @@ -1295,14 +1295,14 @@ def set_content_crs_header( headers['Content-Crs'] = f'<{content_crs_uri}>' -def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: +def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, dict]]: # noqa """ Get OpenAPI fragments :param cfg: `dict` of configuration :param locale: `str` of locale - :returns: `tuple` of `list` of tags, and `dict` of path objects + :returns: `tuple` of `list` of tag objects, and `dict` of path objects """ from pygeoapi.openapi import OPENAPI_YAML, get_visible_collections @@ -1607,4 +1607,4 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: except ProviderTypeError: LOGGER.debug('collection is not feature/item based') - return [], {'paths': paths} + return [{'name': 'records'}, {'name': 'features'}], {'paths': paths} diff --git a/pygeoapi/api/maps.py b/pygeoapi/api/maps.py index a402ce63e..03866fb25 100644 --- a/pygeoapi/api/maps.py +++ b/pygeoapi/api/maps.py @@ -243,14 +243,14 @@ def get_collection_map_legend(api: API, request: APIRequest, data, api.pretty_print) -def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: +def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, dict]]: # noqa """ Get OpenAPI fragments :param cfg: `dict` of configuration :param locale: `str` of locale - :returns: `tuple` of `list` of tags, and `dict` of path objects + :returns: `tuple` of `list` of tag objects, and `dict` of path objects """ from pygeoapi.openapi import OPENAPI_YAML, get_visible_collections @@ -337,4 +337,4 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: paths[pth]['get']['parameters'].append( {'$ref': f"{OPENAPI_YAML['oapif-1']}#/components/parameters/datetime"}) # noqa - return [], {'paths': paths} + return [{'name': 'maps'}], {'paths': paths} diff --git a/pygeoapi/api/processes.py b/pygeoapi/api/processes.py index a29e2b082..6cc7a7180 100644 --- a/pygeoapi/api/processes.py +++ b/pygeoapi/api/processes.py @@ -554,14 +554,14 @@ def delete_job( return {}, http_status, response -def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: +def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, dict]]: # noqa """ Get OpenAPI fragments :param cfg: `dict` of configuration :param locale: `str` of locale - :returns: `tuple` of `list` of tags, and `dict` of path objects + :returns: `tuple` of `list` of tag objects, and `dict` of path objects """ from pygeoapi.openapi import OPENAPI_YAML @@ -737,4 +737,4 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: } } - return ['jobs'], {'paths': paths} + return [{'name': 'proceses'}, {'name': 'jobs'}], {'paths': paths} diff --git a/pygeoapi/api/stac.py b/pygeoapi/api/stac.py index 3ffd0da0c..dc07a806b 100644 --- a/pygeoapi/api/stac.py +++ b/pygeoapi/api/stac.py @@ -224,14 +224,14 @@ def get_stac_path(api: API, request: APIRequest, return headers, HTTPStatus.OK, stac_data -def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: +def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, dict]]: # noqa """ Get OpenAPI fragments :param cfg: `dict` of configuration :param locale: `str` of locale - :returns: `tuple` of `list` of tags, and `dict` of path objects + :returns: `tuple` of `list` of tag objects, and `dict` of path objects """ LOGGER.debug('setting up STAC') @@ -252,4 +252,4 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: } } } - return ['stac'], {'paths': paths} + return [{'name': 'stac'}], {'paths': paths} diff --git a/pygeoapi/api/tiles.py b/pygeoapi/api/tiles.py index 1613bd0a1..5f6dd5fec 100644 --- a/pygeoapi/api/tiles.py +++ b/pygeoapi/api/tiles.py @@ -436,14 +436,14 @@ def tilematrixset(api: API, return headers, HTTPStatus.OK, to_json(tms, api.pretty_print) -def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: +def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, dict]]: # noqa """ Get OpenAPI fragments :param cfg: `dict` of configuration :param locale: `str` of locale - :returns: `tuple` of `list` of tags, and `dict` of path objects + :returns: `tuple` of `list` of tag objects, and `dict` of path objects """ from pygeoapi.openapi import OPENAPI_YAML, get_visible_collections @@ -531,4 +531,4 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[str], dict[str, dict]]: } } - return [], {'paths': paths} + return [{'name': 'tiles'}], {'paths': paths} diff --git a/pygeoapi/openapi.py b/pygeoapi/openapi.py index 52664079f..b089f39c1 100644 --- a/pygeoapi/openapi.py +++ b/pygeoapi/openapi.py @@ -167,7 +167,7 @@ def get_oas_30(cfg: dict, fail_on_invalid_collection: bool = True) -> dict: 'x-keywords': l10n.translate(cfg['metadata']['identification']['keywords'], locale_), # noqa 'termsOfService': cfg['metadata']['identification']['terms_of_service'], - 'contact': { + 'contact': { 'name': cfg['metadata']['provider']['name'], 'url': cfg['metadata']['provider']['url'], 'email': cfg['metadata']['contact']['email'] @@ -455,7 +455,7 @@ def get_oas_30(cfg: dict, fail_on_invalid_collection: bool = True) -> dict: try: sub_tags, sub_paths = api_module.get_oas_30(cfg, locale_) - oas['paths'].update(sub_paths) + oas['paths'].update(sub_paths['paths']) oas['tags'].extend(sub_tags) except Exception as err: if fail_on_invalid_collection: diff --git a/tests/api/test_api.py b/tests/api/test_api.py index 1f2c2f344..c11afca28 100644 --- a/tests/api/test_api.py +++ b/tests/api/test_api.py @@ -595,7 +595,6 @@ def test_describe_collections(config, api_): rsp_headers, code, response = api_.describe_collections(req) collections = json.loads(response) - print(collections) assert len(collections) == 2 assert len(collections['collections']) == 9 assert len(collections['links']) == 3 diff --git a/tests/api/test_coverages.py b/tests/api/test_coverages.py index f8cad2c4c..39b275228 100644 --- a/tests/api/test_coverages.py +++ b/tests/api/test_coverages.py @@ -88,7 +88,6 @@ def test_get_collection_schema(config, api_): assert 'properties' in schema assert len(schema['properties']) == 1 - print(schema['properties']) assert schema['properties']['1']['type'] == 'number' assert schema['properties']['1']['title'] == 'Temperature [C]'