From 91121e629d11f6830e389684ba795c755e1befe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Misbach?= Date: Thu, 14 Sep 2023 11:04:16 +0200 Subject: [PATCH] fix v19 issues --- monitoring/monitorlib/mutate/rid.py | 28 +++++++++++-------- monitoring/monitorlib/rid.py | 4 ++- .../netrid/common/dss_interoperability.py | 2 +- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/monitoring/monitorlib/mutate/rid.py b/monitoring/monitorlib/mutate/rid.py index ae9e3900cc..6f6c98ca4f 100644 --- a/monitoring/monitorlib/mutate/rid.py +++ b/monitoring/monitorlib/mutate/rid.py @@ -349,18 +349,22 @@ def errors(self) -> List[str]: f"Error parsing F3411-22a USS PutIdentificationServiceAreaResponse: {str(e)}" ] - validation_errors = schema_validation.validate( - self.rid_version.openapi_path, - self.rid_version.openapi_delete_isa_response_path - if self.mutation == "delete" - else self.rid_version.openapi_put_isa_response_path, - self.query.response.json, - ) - if validation_errors: - return [ - f"PUT ISA response JSON validation error: [{e.json_path}] {e.message}" - for e in validation_errors - ] + # TODO: This validates the schema only for v22a as the v19 OpenAPI definition contains a mistake in + # 'components.schemas.SubscriptionState', the non-existing property 'subscription' is marked as required. + # The augmented.yaml version of the definition should be fixed and then this can be applied to both version. + if self.rid_version == RIDVersion.f3411_22a: + validation_errors = schema_validation.validate( + self.rid_version.openapi_path, + self.rid_version.openapi_delete_isa_response_path + if self.mutation == "delete" + else self.rid_version.openapi_put_isa_response_path, + self.query.response.json, + ) + if validation_errors: + return [ + f"PUT ISA response JSON validation error: [{e.json_path}] {e.message}" + for e in validation_errors + ] return [] diff --git a/monitoring/monitorlib/rid.py b/monitoring/monitorlib/rid.py index d8fe432a5e..22a612b3b8 100644 --- a/monitoring/monitorlib/rid.py +++ b/monitoring/monitorlib/rid.py @@ -5,6 +5,7 @@ from monitoring.monitorlib import schema_validation from uas_standards.astm.f3411 import v19, v22a +import uas_standards.astm.f3411.v19.api import uas_standards.astm.f3411.v19.constants import uas_standards.astm.f3411.v22a.api import uas_standards.astm.f3411.v22a.constants @@ -211,7 +212,8 @@ def dss_max_subscriptions_per_area(self) -> int: def flights_url_of(self, base_url: str) -> str: if self == RIDVersion.f3411_19: - return base_url + flights_path = v19.api.OPERATIONS[v19.api.OperationID.SearchFlights].path + return base_url + flights_path elif self == RIDVersion.f3411_22a: flights_path = v22a.api.OPERATIONS[v22a.api.OperationID.SearchFlights].path return base_url + flights_path diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss_interoperability.py b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss_interoperability.py index e7b8758d17..e75af70b06 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss_interoperability.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss_interoperability.py @@ -34,7 +34,7 @@ def _default_params(duration: datetime.timedelta) -> Dict: alt_hi=400, start_time=now, end_time=now + duration, - uss_base_url="https://example.com/uss/flights", + uss_base_url="https://example.com", )