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

add license and many other service related rel links to landing page #388

Merged
merged 1 commit into from
Dec 15, 2021
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
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright (c) 2020 Francis Charette-Migneault
Copyright (c) 2020 CRIM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 2 additions & 0 deletions weaver/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
__source_repository__ = "https://github.com/crim-ca/weaver"
__docker_repository__ = "https://hub.docker.com/r/pavics/weaver"
__documentation_url__ = "https://pavics-weaver.readthedocs.io/"
__license_url__ = "https://raw.githubusercontent.com/crim-ca/weaver/master/LICENSE.txt"
__license_type__ = "Apache License 2.0"
__license_short__ = "2020, CRIM"
__license_long__ = f"{__title__} {__license_type__}, Copyright \u24B8 {__license_short__}"
__authors__ = [
"CRIM",
]
Expand Down
23 changes: 16 additions & 7 deletions weaver/wps_restapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def api_frontpage_body(settings):

weaver_api = asbool(settings.get("weaver.wps_restapi"))
weaver_api_url = get_wps_restapi_base_url(settings) if weaver_api else None
weaver_api_def = weaver_api_url + sd.api_swagger_ui_service.path if weaver_api else None
weaver_api_oas_ui = weaver_api_url + sd.api_openapi_ui_service.path if weaver_api else None
weaver_api_swagger = weaver_api_url + sd.api_swagger_ui_service.path if weaver_api else None
weaver_api_doc = settings.get("weaver.wps_restapi_doc", None) if weaver_api else None
weaver_api_ref = settings.get("weaver.wps_restapi_ref", None) if weaver_api else None
weaver_api_spec = weaver_api_url + sd.openapi_json_service.path if weaver_api else None
Expand All @@ -80,21 +81,29 @@ def api_frontpage_body(settings):
weaver_process_url = weaver_url + sd.processes_service.path
weaver_jobs_url = weaver_url + sd.jobs_service.path
weaver_links = [
{"href": weaver_url, "rel": "self", "type": CONTENT_TYPE_APP_JSON, "title": "This document"},
{"href": weaver_url, "rel": "self", "type": CONTENT_TYPE_APP_JSON, "title": "This landing page."},
{"href": weaver_conform_url, "rel": "http://www.opengis.net/def/rel/ogc/1.0/conformance",
"type": CONTENT_TYPE_APP_JSON, "title": "Conformance classes implemented by this service."},
{"href": __meta__.__license_url__, "rel": "license",
"type": CONTENT_TYPE_TEXT_PLAIN, "title": __meta__.__license_long__}
]
if weaver_api:
weaver_links.extend([
{"href": weaver_api_url,
"rel": "service", "type": CONTENT_TYPE_APP_JSON,
"title": "WPS REST API endpoint of this service."},
{"href": weaver_api_def,
"rel": "swagger-ui", "type": CONTENT_TYPE_TEXT_HTML,
"title": "WPS REST API definition of this service."},
{"href": weaver_api_spec,
"rel": "service-desc", "type": CONTENT_TYPE_APP_JSON,
"title": "OpenAPI specification of this service."},
{"href": weaver_api_oas_ui,
"rel": "service-doc", "type": CONTENT_TYPE_TEXT_HTML,
"title": "Human readable OpenAPI documentation of this service."},
{"href": weaver_api_spec,
"rel": "OpenAPI", "type": CONTENT_TYPE_APP_JSON,
"title": "WPS REST API specification of this service."},
"title": "OpenAPI specification of this service."},
{"href": weaver_api_swagger,
"rel": "swagger-ui", "type": CONTENT_TYPE_TEXT_HTML,
"title": "WPS REST API definition of this service."},
{"href": weaver_process_url,
"rel": "http://www.opengis.net/def/rel/ogc/1.0/processes", "type": CONTENT_TYPE_APP_JSON,
"title": "Processes offered by this service."},
Expand Down Expand Up @@ -167,7 +176,7 @@ def api_frontpage_body(settings):
"parameters": [
{"name": "api", "enabled": weaver_api,
"url": weaver_api_url,
"api": weaver_api_def},
"api": weaver_api_oas_ui},
{"name": "wps", "enabled": weaver_wps,
"url": weaver_wps_url},
],
Expand Down