Skip to content

Commit

Permalink
fix v19 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mickmis committed Sep 14, 2023
1 parent d39e218 commit 91121e6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
28 changes: 16 additions & 12 deletions monitoring/monitorlib/mutate/rid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 []

Expand Down
4 changes: 3 additions & 1 deletion monitoring/monitorlib/rid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)


Expand Down

0 comments on commit 91121e6

Please sign in to comment.