Skip to content

Commit

Permalink
add links to process summary listing (fix #622)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Apr 29, 2024
1 parent 918f089 commit 7825e88
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ Changes

Changes:
--------
- Add multiple missing `OGC API - Processes` conformance references.
- Modify default query parameter value ``links=true`` for ``/processes`` summary listing to conform with
conformance class ``/conf/core/process-summary-links`` as default behavior
(relates to `opengeospatial/ogcapi-processes#406 <https://github.com/opengeospatial/ogcapi-processes/pull/406>`_).
(relates to `opengeospatial/ogcapi-processes#406 <https://github.com/opengeospatial/ogcapi-processes/pull/406>`_,
fixes `crim-ca/weaver#622 <https://github.com/crim-ca/weaver/issues/622>`_).

Fixes:
------
Expand Down
3 changes: 2 additions & 1 deletion weaver/wps_restapi/processes/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ def get_processes(request):
"value": repr_json(ex.value or dict(request.params), force_string=False),
})

links = asbool(params.get("links", True))
detail = asbool(params.get("detail", True))
ignore = asbool(params.get("ignore", True))
try:
# get local processes and filter according to schema validity
# (previously deployed process schemas can become invalid because of modified schema definitions
results = get_processes_filtered_by_valid_schemas(request, detail=detail)
results = get_processes_filtered_by_valid_schemas(request, detail=detail, links=links)
processes, invalid_processes, paging, with_providers, total_processes = results
if invalid_processes:
raise HTTPServiceUnavailable(
Expand Down
6 changes: 3 additions & 3 deletions weaver/wps_restapi/processes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def resolve_process_tag(request, process_query=False):
return process_id


def get_processes_filtered_by_valid_schemas(request, detail=True):
# type: (PyramidRequest, bool) -> Tuple[List[JSON], List[str], Dict[str, Optional[int]], bool, int]
def get_processes_filtered_by_valid_schemas(request, detail=True, links=True):
# type: (PyramidRequest, bool, bool) -> Tuple[List[JSON], List[str], Dict[str, Optional[int]], bool, int]
"""
Validates the processes summary schemas and returns them into valid/invalid lists.
Expand All @@ -71,7 +71,7 @@ def get_processes_filtered_by_valid_schemas(request, detail=True):
with_providers = asbool(request.params.get("providers", False))
revisions_param = sd.ProcessRevisionsQuery(unknown="ignore").deserialize(request.params)
with_revisions = revisions_param.get("revisions")
with_links = asbool(request.params.get("links", False)) and detail
with_links = links and detail
paging_query = sd.ProcessPagingQuery()
paging_value = {param.name: param.default for param in paging_query.children}
paging_names = set(paging_value)
Expand Down
2 changes: 1 addition & 1 deletion weaver/wps_restapi/swagger_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5906,7 +5906,7 @@ class ProcessDetailQuery(ExtendedMappingSchema):

class ProcessLinksQuery(ExtendedMappingSchema):
links = ExtendedSchemaNode(
QueryBoolean(), example=True, default=True, missing=drop,
QueryBoolean(), example=True, default=True, missing=True,
description="Return summary details with included links for each process."
)

Expand Down

0 comments on commit 7825e88

Please sign in to comment.