Skip to content

Commit

Permalink
update missing conformance links
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Apr 29, 2024
1 parent 25bde5c commit 918f089
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 50 deletions.
6 changes: 3 additions & 3 deletions weaver/processes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def _save_deploy_process(process, override, container):
process_summary = new_process.summary(container=container)
except ProcessRegistrationError as exc:
raise HTTPConflict(json={
"type": "ProcessRegistrationError",
"type": "http://www.opengis.net/def/exceptions/ogcapi-processes-2/1.0/duplicated-process",
"title": "Process definition conflict.",
"detail": str(exc),
"status": HTTPConflict.code,
Expand Down Expand Up @@ -545,7 +545,7 @@ def _update_deploy_process_version(process, process_overwrite, update_level, con
"""
if not process.mutable:
raise HTTPForbidden(json={
"type": "ProcessImmutable",
"type": "http://www.opengis.net/def/exceptions/ogcapi-processes-2/1.0/immutable-process",
"title": "Process immutable.",
"detail": "Cannot update an immutable process.",
"status": HTTPForbidden.code,
Expand Down Expand Up @@ -615,7 +615,7 @@ def _update_deploy_process_version(process, process_overwrite, update_level, con
if new_version is not None:
new_version = as_version_major_minor_patch(new_version, VersionFormat.STRING)
raise HTTPConflict(json={
"type": "ProcessRegistrationError",
"type": "http://www.opengis.net/def/exceptions/ogcapi-processes-2/1.0/duplicated-process",
"title": "Process definition conflict.",
"detail": "Failed update of process conflicting with another definition or revision.",
"status": HTTPConflict.code,
Expand Down
9 changes: 5 additions & 4 deletions weaver/typedefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,10 +629,11 @@ class CWL_SchemaName(Protocol):
}, total=True)
OpenAPISpecInfo = TypedDict("OpenAPISpecInfo", {
"description": NotRequired[str],
"licence": OpenAPISpecLicence,
"contact": OpenAPISpecContact,
"title": str,
"version": str,
"licence": NotRequired[OpenAPISpecLicence],
"contact": NotRequired[OpenAPISpecContact],
"termsOfService": NotRequired[str],
"title": NotRequired[str],
"version": NotRequired[str],
}, total=True)
OpenAPISpecContent = TypedDict("OpenAPISpecContent", {
"schema": OpenAPISchema,
Expand Down
154 changes: 114 additions & 40 deletions weaver/wps_restapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if TYPE_CHECKING:
from typing import Any, Callable, List, Optional

from weaver.typedefs import JSON, OpenAPISpecification, SettingsType, TypedDict
from weaver.typedefs import JSON, OpenAPISpecification, OpenAPISpecInfo, SettingsType, TypedDict
from weaver.wps_restapi.constants import AnyConformanceCategory

Conformance = TypedDict("Conformance", {
Expand Down Expand Up @@ -162,8 +162,6 @@ def get_conformance(category):
f"{ogcapi_proc_core}/conf/core/conformance-op",
f"{ogcapi_proc_core}/conf/core/conformance-success",
f"{ogcapi_proc_core}/conf/core/http",
f"{ogcapi_proc_core}/conf/core/landingpage-op",
f"{ogcapi_proc_core}/conf/core/landingpage-success",
f"{ogcapi_proc_core}/conf/core/job-exception-no-such-job",
f"{ogcapi_proc_core}/conf/core/job-op",
f"{ogcapi_proc_core}/conf/core/job-result",
Expand All @@ -172,19 +170,55 @@ def get_conformance(category):
# FIXME: https://github.com/crim-ca/weaver/issues/18
# f"{ogcapi_proc_core}/conf/core/job-results-async-one",
f"{ogcapi_proc_core}/conf/core/job-results-exception-no-such-job",
f"{ogcapi_proc_core}/conf/core/job-results-exception-results-not-ready",
f"{ogcapi_proc_core}/conf/core/job-results-failed",
f"{ogcapi_proc_core}/conf/core/job-results-param-outputs",
f"{ogcapi_proc_core}/conf/core/job-results-param-outputs-empty",
f"{ogcapi_proc_core}/conf/core/job-results-param-outputs-omit",
# FIXME: https://github.com/crim-ca/weaver/issues/380
# f"{ogcapi_proc_core}/conf/core/job-results-param-outputs-response",
f"{ogcapi_proc_core}/conf/core/job-results-success-sync",
f"{ogcapi_proc_core}/conf/core/job-success",
f"{ogcapi_proc_core}/conf/core/landingpage-op",
f"{ogcapi_proc_core}/conf/core/landingpage-success",
f"{ogcapi_proc_core}/conf/core/pl-limit-definition",
f"{ogcapi_proc_core}/conf/core/pl-limit-response",
f"{ogcapi_proc_core}/conf/core/pl-links",
f"{ogcapi_proc_core}/conf/core/process-description",
f"{ogcapi_proc_core}/conf/core/process-description-success",
f"{ogcapi_proc_core}/conf/core/process-description-no-such-process",
f"{ogcapi_proc_core}/conf/core/process-execute-auto-execution-mode",
f"{ogcapi_proc_core}/conf/core/process-execute-default-execution-mode",
f"{ogcapi_proc_core}/conf/core/process-execute-default-outputs",
f"{ogcapi_proc_core}/conf/core/process-execute-input-array",
f"{ogcapi_proc_core}/conf/core/process-execute-input-inline-bbox",
# FIXME: support byte/binary type (string + format:byte) ?
# f"{ogcapi_proc_core}/conf/core/process-execute-input-inline-binary",
f"{ogcapi_proc_core}/conf/core/process-execute-input-inline-mixed",
f"{ogcapi_proc_core}/conf/core/process-execute-input-inline-object",
f"{ogcapi_proc_core}/conf/core/process-execute-input-validation",
f"{ogcapi_proc_core}/conf/core/process-execute-inputs",
f"{ogcapi_proc_core}/conf/core/process-execute-input-validation",
f"{ogcapi_proc_core}/conf/core/process-execute-op",
f"{ogcapi_proc_core}/conf/core/process-execute-request",
f"{ogcapi_proc_core}/conf/core/process-execute-success-async",
f"{ogcapi_proc_core}/conf/core/process-execute-sync-many-json",
# FIXME: https://github.com/crim-ca/weaver/issues/18
# f"{ogcapi_proc_core}/conf/core/process-execute-sync-one",
# f"{ogcapi_proc_core}/conf/core/process-execute-sync-default-content",
f"{ogcapi_proc_core}/conf/core/process-list",
f"{ogcapi_proc_core}/conf/core/process-list-op",
f"{ogcapi_proc_core}/conf/core/process-list-success",
f"{ogcapi_proc_core}/conf/core/process-summary-links",
f"{ogcapi_proc_core}/conf/callback",
f"{ogcapi_proc_core}/conf/callback/job-callback",
f"{ogcapi_proc_core}/conf/dismiss",
f"{ogcapi_proc_core}/conf/dismiss/job-dismiss-op",
f"{ogcapi_proc_core}/conf/dismiss/job-dismiss-success",
# FIXME: https://github.com/crim-ca/weaver/issues/210
# ogcapi_proc_core + "/conf/html",
# ogcapi_proc_core + "/conf/html/content",
# ogcapi_proc_core + "/conf/html/definition",
# f"{ogcapi_proc_core}/conf/html",
# f"{ogcapi_proc_core}/conf/html/content",
# f"{ogcapi_proc_core}/conf/html/definition",
f"{ogcapi_proc_core}/conf/json",
f"{ogcapi_proc_core}/conf/json/content",
f"{ogcapi_proc_core}/conf/json/definition",
Expand All @@ -198,33 +232,31 @@ def get_conformance(category):
f"{ogcapi_proc_core}/per/core/alternative-process-description",
f"{ogcapi_proc_core}/per/core/alternative-process-paths",
f"{ogcapi_proc_core}/per/core/api-definition-uri",
# FIXME: BoundingBox not implemented (https://github.com/crim-ca/weaver/issues/51)
# ogcapi_proc_core + "/per/core/process-execute-input-inline-bbox",
f"{ogcapi_proc_core}/per/core/process-execute-input-inline-bbox",
f"{ogcapi_proc_core}/per/core/process-execute-sync-job",
f"{ogcapi_proc_core}/per/core/limit-response",
f"{ogcapi_proc_core}/per/core/limit-default-minimum-maximum",
f"{ogcapi_proc_core}/per/core/prev",
f"{ogcapi_proc_core}/per/job-list/limit-response",
f"{ogcapi_proc_core}/per/job-list/prev",
# ogcapi_proc_core + "/rec/core/access-control-expose-headers",
# f"{ogcapi_proc_core}/rec/core/access-control-expose-headers",
f"{ogcapi_proc_core}/rec/core/api-definition-oas",
f"{ogcapi_proc_core}/rec/core/cross-origin",
f"{ogcapi_proc_core}/rec/core/content-length",
# ogcapi_proc_core + "/rec/core/html",
# ogcapi_proc_core + "/rec/core/http-head",
# f"{ogcapi_proc_core}/rec/core/html",
# f"{ogcapi_proc_core}/rec/core/http-head",
f"{ogcapi_proc_core}/rec/core/job-status",
f"{ogcapi_proc_core}/rec/core/job-results-async-many-json-prefer-none",
# FIXME: https://github.com/crim-ca/weaver/issues/414
# ogcapi_proc_core + "/rec/core/job-results-async-many-json-prefer-minimal",
# ogcapi_proc_core + "/rec/core/job-results-async-many-json-prefer-representation",
# ogcapi_proc_core + "/per/core/job-results-async-many-other-formats",
# f"{ogcapi_proc_core}/rec/core/job-results-async-many-json-prefer-minimal",
# f"{ogcapi_proc_core}/rec/core/job-results-async-many-json-prefer-representation",
# f"{ogcapi_proc_core}/per/core/job-results-async-many-other-formats",
f"{ogcapi_proc_core}/rec/core/process-execute-sync-many-json-prefer-none",
# ogcapi_proc_core + "/rec/core/process-execute-sync-many-json-prefer-minimal",
# ogcapi_proc_core + "/rec/core/process-execute-sync-many-json-prefer-representation",
# ogcapi_proc_core + "/rec/core/link-header",
# f"{ogcapi_proc_core}/rec/core/process-execute-sync-many-json-prefer-minimal",
# f"{ogcapi_proc_core}/rec/core/process-execute-sync-many-json-prefer-representation",
# f"{ogcapi_proc_core}/rec/core/link-header",
f"{ogcapi_proc_core}/rec/core/ogc-process-description",
# FIXME: error details (for all below: https://github.com/crim-ca/weaver/issues/320)
# ogcapi_proc_core + "/rec/core/problem-details",
f"{ogcapi_proc_core}/rec/core/problem-details",
f"{ogcapi_proc_core}/rec/core/process-execute-handle-prefer",
f"{ogcapi_proc_core}/rec/core/process-execute-honor-prefer",
f"{ogcapi_proc_core}/rec/core/process-execute-mode-auto",
Expand All @@ -233,7 +265,7 @@ def get_conformance(category):
f"{ogcapi_proc_core}/rec/core/next-1",
f"{ogcapi_proc_core}/rec/core/next-2",
f"{ogcapi_proc_core}/rec/core/next-3",
# ogcapi_proc_core + "/rec/core/test-process",
f"{ogcapi_proc_core}/rec/core/test-process",
f"{ogcapi_proc_core}/rec/job-list/job-list-landing-page",
f"{ogcapi_proc_core}/rec/job-list/next-1",
f"{ogcapi_proc_core}/rec/job-list/next-2",
Expand All @@ -253,9 +285,9 @@ def get_conformance(category):
f"{ogcapi_proc_core}/req/core/job-results",
f"{ogcapi_proc_core}/req/core/job-results-async-document",
# FIXME: support raw multipart (https://github.com/crim-ca/weaver/issues/376)
# ogcapi_proc_core + "/req/core/job-results-async-raw-mixed-multi",
# f"{ogcapi_proc_core}/req/core/job-results-async-raw-mixed-multi",
f"{ogcapi_proc_core}/req/core/job-results-async-raw-ref",
# ogcapi_proc_core + "/req/core/job-results-async-raw-value-multi",
# f"{ogcapi_proc_core}/req/core/job-results-async-raw-value-multi",
f"{ogcapi_proc_core}/req/core/job-results-async-raw-value-one",
f"{ogcapi_proc_core}/req/core/job-results-success-sync",
f"{ogcapi_proc_core}/req/core/job-success",
Expand All @@ -269,10 +301,9 @@ def get_conformance(category):
f"{ogcapi_proc_core}/req/core/process-execute-default-execution-mode",
f"{ogcapi_proc_core}/req/core/process-execute-default-outputs",
f"{ogcapi_proc_core}/req/core/process-execute-input-array",
# FIXME: BoundingBox not implemented (https://github.com/crim-ca/weaver/issues/51)
# ogcapi_proc_core + "/req/core/process-execute-input-inline-bbox",
f"{ogcapi_proc_core}/req/core/process-execute-input-inline-bbox",
# FIXME: support byte/binary type (string + format:byte) ?
# ogcapi_proc_core + "/req/core/process-execute-input-inline-binary",
# f"{ogcapi_proc_core}/req/core/process-execute-input-inline-binary",
f"{ogcapi_proc_core}/req/core/process-execute-input-mixed-type",
f"{ogcapi_proc_core}/req/core/process-execute-input-inline-object",
f"{ogcapi_proc_core}/req/core/process-execute-input-validation",
Expand All @@ -281,23 +312,23 @@ def get_conformance(category):
f"{ogcapi_proc_core}/req/core/process-execute-request",
f"{ogcapi_proc_core}/req/core/process-execute-success-async",
f"{ogcapi_proc_core}/req/core/process-execute-sync-document",
# ogcapi_proc_core + "/req/core/process-execute-sync-raw-mixed-multi",
# f"{ogcapi_proc_core}/req/core/process-execute-sync-raw-mixed-multi",
f"{ogcapi_proc_core}/req/core/process-execute-sync-raw-ref",
# FIXME: support raw multipart (https://github.com/crim-ca/weaver/issues/376)
# ogcapi_proc_core + "/req/core/process-execute-sync-raw-value-multi",
# f"{ogcapi_proc_core}/req/core/process-execute-sync-raw-value-multi",
f"{ogcapi_proc_core}/req/core/process-execute-sync-raw-value-one",
f"{ogcapi_proc_core}/req/core/pl-limit-definition",
f"{ogcapi_proc_core}/req/core/pl-limit-response",
f"{ogcapi_proc_core}/req/core/process-list",
f"{ogcapi_proc_core}/req/core/process-list-success",
# ogcapi_proc_core + "/req/core/test-process",
f"{ogcapi_proc_core}/req/core/test-process",
f"{ogcapi_proc_core}/req/dismiss",
f"{ogcapi_proc_core}/req/dismiss/job-dismiss-op",
f"{ogcapi_proc_core}/req/dismiss/job-dismiss-success",
# https://github.com/opengeospatial/ogcapi-processes/blob/master/core/clause_7_core.adoc#sc_requirements_class_html
# ogcapi_proc_core + "/req/html",
# ogcapi_proc_core + "/req/html/content",
# ogcapi_proc_core + "/req/html/definition",
# FIXME: https://github.com/crim-ca/weaver/issues/210
# f"{ogcapi_proc_core}/req/html",
# f"{ogcapi_proc_core}/req/html/content",
# f"{ogcapi_proc_core}/req/html/definition",
f"{ogcapi_proc_core}/req/json",
f"{ogcapi_proc_core}/req/json/definition",
f"{ogcapi_proc_core}/req/job-list/links",
Expand All @@ -322,14 +353,46 @@ def get_conformance(category):
f"{ogcapi_proc_core}/req/ogc-process-description/output-def",
f"{ogcapi_proc_core}/req/ogc-process-description/output-mixed-type",
f"{ogcapi_proc_core}/req/ogc-process-description/outputs-def",
f"{ogcapi_proc_part2}/conf/cwl",
f"{ogcapi_proc_part2}/conf/cwl/deploy/body",
f"{ogcapi_proc_part2}/conf/cwl/deploy/response-body",
f"{ogcapi_proc_part2}/conf/cwl/deploy/response",
f"{ogcapi_proc_part2}/conf/cwl/replace/body",
f"{ogcapi_proc_part2}/conf/cwl/replace/response",
# FIXME: support 'docker' direct deployment without CWL?
# f"{ogcapi_proc_part2}/conf/docker",
# f"{ogcapi_proc_part2}/conf/docker/deploy/body",
# f"{ogcapi_proc_part2}/conf/docker/replace/body",
f"{ogcapi_proc_part2}/conf/dru",
# FIXME: https://github.com/crim-ca/weaver/issues/624
# f"{ogcapi_proc_part2}/conf/dru/deploy/content-type",
f"{ogcapi_proc_part2}/conf/dru/deploy/post-op",
# FIXME: https://github.com/crim-ca/weaver/issues/624
# f"{ogcapi_proc_part2}/conf/dru/deploy/unsupported-content-type",
# FIXME: https://github.com/crim-ca/weaver/issues/624
# f"{ogcapi_proc_part2}/conf/dru/replace/content-type",
f"{ogcapi_proc_part2}/conf/dru/replace/put-op",
# FIXME: https://github.com/crim-ca/weaver/issues/624
# f"{ogcapi_proc_part2}/conf/dru/replace/unsupported-content-type",
f"{ogcapi_proc_part2}/conf/dru/undeploy/delete-op",
f"{ogcapi_proc_part2}/conf/dru/undeploy/response-immutable-success",
f"{ogcapi_proc_part2}/conf/dru/undeploy/response-immutable",
f"{ogcapi_proc_part2}/conf/dru/undeploy/response",
f"{ogcapi_proc_part2}/conf/dru/undeploy/mutable-process",
f"{ogcapi_proc_part2}/conf/dru/process-list-success",
f"{ogcapi_proc_part2}/conf/dru/static-indicator",
f"{ogcapi_proc_part2}/conf/dru/test-process",
f"{ogcapi_proc_part2}/conf/dru/test-process",
f"{ogcapi_proc_part2}/conf/ogcapppkg",
f"{ogcapi_proc_part2}/conf/ogcapppkg/deploy/body",
f"{ogcapi_proc_part2}/conf/ogcapppkg/deploy/response",
f"{ogcapi_proc_part2}/conf/ogcapppkg/deploy/response-duplicate",
f"{ogcapi_proc_part2}/conf/ogcapppkg/deploy/response-success",
f"{ogcapi_proc_part2}/conf/ogcapppkg/replace/body",
f"{ogcapi_proc_part2}/conf/ogcapppkg/replace/response",
f"{ogcapi_proc_part2}/per/deploy-replace-undeploy/replace/body",
f"{ogcapi_proc_part2}/rec/deploy-replace-undeploy/deploy/body-ogcapppkg",
f"{ogcapi_proc_part2}/rec/deploy-replace-undeploy/replace/body-ogcapppkg",
f"{ogcapi_proc_part2}/req/ogcapppkg",
f"{ogcapi_proc_part2}/req/ogcapppkg/execution-unit-docker",
f"{ogcapi_proc_part2}/req/ogcapppkg/process-description",
f"{ogcapi_proc_part2}/req/ogcapppkg/profile-docker",
f"{ogcapi_proc_part2}/req/ogcapppkg/schema",
f"{ogcapi_proc_part2}/req/deploy-replace-undeploy",
f"{ogcapi_proc_part2}/req/deploy-replace-undeploy/deploy/body",
f"{ogcapi_proc_part2}/req/deploy-replace-undeploy/deploy/content-type",
Expand All @@ -345,6 +408,12 @@ def get_conformance(category):
f"{ogcapi_proc_part2}/req/deploy-replace-undeploy/undeploy/delete-op",
f"{ogcapi_proc_part2}/req/deploy-replace-undeploy/undeploy/response",
f"{ogcapi_proc_part2}/req/deploy-replace-undeploy/ogcapppkg",
f"{ogcapi_proc_part2}/req/dru/test-process",
f"{ogcapi_proc_part2}/req/ogcapppkg",
f"{ogcapi_proc_part2}/req/ogcapppkg/execution-unit-docker",
f"{ogcapi_proc_part2}/req/ogcapppkg/process-description",
f"{ogcapi_proc_part2}/req/ogcapppkg/profile-docker",
f"{ogcapi_proc_part2}/req/ogcapppkg/schema",
# FIXME: below partially, for full Part 3, would need $graph support
# (see https://github.com/crim-ca/weaver/issues/56 and below '/conf/app-pck/cwl')
f"{ogcapi_proc_part3}/req/cwl-workflows",
Expand Down Expand Up @@ -642,7 +711,7 @@ def get_openapi_json(http_scheme="http", http_host="localhost", base_url=None,
"name": __meta__.__license_type__,
"url": f"{__meta__.__source_repository__}/blob/master/LICENSE.txt",
}
}
} # type: OpenAPISpecInfo
if settings:
for key in ["name", "email", "url"]:
val = settings.get(f"weaver.wps_metadata_contact_{key}")
Expand All @@ -662,8 +731,13 @@ def get_openapi_json(http_scheme="http", http_host="localhost", base_url=None,
if terms:
swagger_info["termsOfService"] = terms[0]

swagger_json = swagger.generate(title=sd.API_TITLE, version=__meta__.__version__, info=swagger_info,
base_path=swagger_base_path, openapi_spec=3)
swagger_json = swagger.generate(
title=sd.API_TITLE,
version=__meta__.__version__,
info=swagger_info,
base_path=swagger_base_path,
openapi_spec=3,
)
swagger_json["externalDocs"] = sd.API_DOCS
return swagger_json

Expand Down
Loading

0 comments on commit 918f089

Please sign in to comment.