Skip to content

Commit

Permalink
fix rendering of provider schema reference in response body (relates to
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Sep 6, 2023
1 parent a0b3d21 commit c6a351f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Changes:
Fixes:
------
- Fix broken `OpenAPI` schema link references to `OGC API - Processes` repository.
- Fix ``GET /providers/{provider_id}`` response using ``$schema`` instead of ``$id`` to provide its content schema.

.. _changes_4.30.1:

Expand Down
5 changes: 4 additions & 1 deletion weaver/wps_restapi/providers/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ def get_provider(request):
Get a provider definition (GetCapabilities).
"""
service, _ = get_service(request)
return HTTPOk(json=service.summary(request))
data = get_schema_ref(sd.ProviderSummarySchema, request, ref_name=False)
info = service.summary(request)
data.update(info)
return HTTPOk(json=data)


@sd.provider_processes_service.get(tags=[sd.TAG_PROVIDERS, sd.TAG_PROCESSES, sd.TAG_PROVIDERS, sd.TAG_GETCAPABILITIES],
Expand Down
1 change: 1 addition & 0 deletions weaver/wps_restapi/swagger_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3036,6 +3036,7 @@ class ProviderSummarySchema(DescriptionType, ProviderPublic, DescriptionMeta, De
url = URL(description="Endpoint of the service provider.")
type = ExtendedSchemaNode(String())

_schema_meta_include = True
_sort_first = PROVIDER_DESCRIPTION_FIELD_FIRST
_sort_after = PROVIDER_DESCRIPTION_FIELD_AFTER

Expand Down
4 changes: 2 additions & 2 deletions weaver/wps_restapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_wps_restapi_base_url(container):
return weaver_rest_url.rstrip("/").strip()


def get_schema_ref(schema, container=None, ref_type="$schema", ref_name=True):
def get_schema_ref(schema, container=None, ref_type="$id", ref_name=True):
# type: (colander.SchemaNode, Optional[AnySettingsContainer], str, True) -> Dict[str, str]
"""
Generates the JSON OpenAPI schema reference relative to the current `Weaver` instance.
Expand All @@ -123,7 +123,7 @@ def get_schema_ref(schema, container=None, ref_type="$schema", ref_name=True):
:param schema: schema-node instance or type for which to generate the OpenAPI reference.
:param container: application settings to retrieve the base URL of the schema location.
:param ref_type: key employed to form the reference (e.g.: "$schema", "$ref", "@schema", etc.)
:param ref_type: key employed to form the reference (e.g.: "$id", "$ref", "$schema", "@id", etc.).
:param ref_name: indicate if the plain name should also be included under field ``"schema"``.
:return: OpenAPI schema reference
"""
Expand Down

0 comments on commit c6a351f

Please sign in to comment.