From 246d0221ab8b6beab87d00b562163b087834e8ff Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 6 Feb 2026 14:23:40 +0000 Subject: [PATCH 1/5] fix schema issue and add tests to prevent regressions --- CHANGELOG.md | 3 +- api_app/_version.py | 2 +- api_app/models/schemas/airlock_request.py | 6 ++-- api_app/models/schemas/operation.py | 3 +- .../test_airlock_request_schema.py | 18 ++++++++++ .../test_models/test_operation_schema.py | 33 +++++++++++++++++++ 6 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 api_app/tests_ma/test_models/test_airlock_request_schema.py create mode 100644 api_app/tests_ma/test_models/test_operation_schema.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 657f15cdf8..06ac541d88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ ENHANCEMENTS: * _No changes yet_ BUG FIXES: -* _No changes yet_ +* Fix test function get_sample_operation step params. ([#4684](https://github.com/microsoft/AzureTRE/issues/4864)) +* Fix airlock request sample data fields and enum values. ## 0.27.0 (February 5, 2026) **BREAKING CHANGES** diff --git a/api_app/_version.py b/api_app/_version.py index 6623c5202f..2cb28789f2 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.25.14" +__version__ = "0.25.15" diff --git a/api_app/models/schemas/airlock_request.py b/api_app/models/schemas/airlock_request.py index 0cc1ccbe42..c8e480e7ad 100644 --- a/api_app/models/schemas/airlock_request.py +++ b/api_app/models/schemas/airlock_request.py @@ -9,15 +9,15 @@ def get_sample_airlock_review(airlock_review_id: str) -> dict: return { - "reviewId": airlock_review_id, - "reviewDecision": "Describe why the request was approved/rejected", + "id": airlock_review_id, + "reviewDecision": "approved", "decisionExplanation": "Describe why the request was approved/rejected" } def get_sample_airlock_request(workspace_id: str, airlock_request_id: str) -> dict: return { - "requestId": airlock_request_id, + "id": airlock_request_id, "workspaceId": workspace_id, "status": "draft", "type": "import", diff --git a/api_app/models/schemas/operation.py b/api_app/models/schemas/operation.py index 4b4c833c14..bf5740eabe 100644 --- a/api_app/models/schemas/operation.py +++ b/api_app/models/schemas/operation.py @@ -16,7 +16,8 @@ def get_sample_operation(operation_id: str) -> dict: "updatedWhen": 1642611942.423857, "steps": [ { - "stepId": "main", + "id": "7d96130f-b323-4b95-8351-a05e943d51a2", + "templateStepId": "main", "stepTitle": "deployment for main", "resourceId": "933ad738-7265-4b5f-9eae-a1a62928772e", "resourceTemplateName": "tre-workspace-base", diff --git a/api_app/tests_ma/test_models/test_airlock_request_schema.py b/api_app/tests_ma/test_models/test_airlock_request_schema.py new file mode 100644 index 0000000000..d0fa025e3b --- /dev/null +++ b/api_app/tests_ma/test_models/test_airlock_request_schema.py @@ -0,0 +1,18 @@ +import pytest +from models.schemas.airlock_request import AirlockRequestAndOperationInResponse, get_sample_airlock_request +from models.schemas.operation import get_sample_operation + +def test_airlock_request_and_operation_in_response_schema_is_valid(): + workspace_id = "933ad738-7265-4b5f-9eae-a1a62928772e" + airlock_request_id = "121e921f-a4aa-44b3-90a9-e8da030495ef" + operation_id = "121e921f-a4aa-44b3-90a9-e8da030495ef" + + sample_data = { + "airlockRequest": get_sample_airlock_request(workspace_id, airlock_request_id), + "operation": get_sample_operation(operation_id) + } + + # This validates the schema extra example logic + response = AirlockRequestAndOperationInResponse(**sample_data) + assert response.airlockRequest.id == airlock_request_id + assert response.operation.id == operation_id diff --git a/api_app/tests_ma/test_models/test_operation_schema.py b/api_app/tests_ma/test_models/test_operation_schema.py new file mode 100644 index 0000000000..7aad0a35e0 --- /dev/null +++ b/api_app/tests_ma/test_models/test_operation_schema.py @@ -0,0 +1,33 @@ +import pytest +from models.domain.operation import Operation +from models.schemas.operation import get_sample_operation, OperationInResponse, OperationInList + +def test_get_sample_operation_is_valid(): + operation_id = "7ac667f0-fd3f-4a6c-815b-82d0cb7a2132" + sample_operation_dict = get_sample_operation(operation_id) + + # This will raise a ValidationError if the dictionary doesn't match the Operation model + operation = Operation(**sample_operation_dict) + + assert operation.id == operation_id + assert len(operation.steps) > 0 + assert operation.steps[0].templateStepId == "main" + +def test_operation_in_response_schema_is_valid(): + operation_id = "7ac667f0-fd3f-4a6c-815b-82d0cb7a2132" + sample_data = { + "operation": get_sample_operation(operation_id) + } + # This validates the schema extra example logic + response = OperationInResponse(**sample_data) + assert response.operation.id == operation_id + +def test_operation_in_list_schema_is_valid(): + operation_id = "7ac667f0-fd3f-4a6c-815b-82d0cb7a2132" + sample_data = { + "operations": [get_sample_operation(operation_id)] + } + # This validates the schema extra example logic + op_list = OperationInList(**sample_data) + assert len(op_list.operations) == 1 + assert op_list.operations[0].id == operation_id From ede7e777ca52fa223dfb7d48a85bf49d4a65008a Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 6 Feb 2026 14:33:38 +0000 Subject: [PATCH 2/5] formatting and remove unused import --- api_app/tests_ma/test_models/test_airlock_request_schema.py | 2 +- api_app/tests_ma/test_models/test_operation_schema.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api_app/tests_ma/test_models/test_airlock_request_schema.py b/api_app/tests_ma/test_models/test_airlock_request_schema.py index d0fa025e3b..78ea429cb6 100644 --- a/api_app/tests_ma/test_models/test_airlock_request_schema.py +++ b/api_app/tests_ma/test_models/test_airlock_request_schema.py @@ -1,7 +1,7 @@ -import pytest from models.schemas.airlock_request import AirlockRequestAndOperationInResponse, get_sample_airlock_request from models.schemas.operation import get_sample_operation + def test_airlock_request_and_operation_in_response_schema_is_valid(): workspace_id = "933ad738-7265-4b5f-9eae-a1a62928772e" airlock_request_id = "121e921f-a4aa-44b3-90a9-e8da030495ef" diff --git a/api_app/tests_ma/test_models/test_operation_schema.py b/api_app/tests_ma/test_models/test_operation_schema.py index 7aad0a35e0..9a79d9acad 100644 --- a/api_app/tests_ma/test_models/test_operation_schema.py +++ b/api_app/tests_ma/test_models/test_operation_schema.py @@ -1,7 +1,7 @@ -import pytest from models.domain.operation import Operation from models.schemas.operation import get_sample_operation, OperationInResponse, OperationInList + def test_get_sample_operation_is_valid(): operation_id = "7ac667f0-fd3f-4a6c-815b-82d0cb7a2132" sample_operation_dict = get_sample_operation(operation_id) @@ -13,6 +13,7 @@ def test_get_sample_operation_is_valid(): assert len(operation.steps) > 0 assert operation.steps[0].templateStepId == "main" + def test_operation_in_response_schema_is_valid(): operation_id = "7ac667f0-fd3f-4a6c-815b-82d0cb7a2132" sample_data = { @@ -22,6 +23,7 @@ def test_operation_in_response_schema_is_valid(): response = OperationInResponse(**sample_data) assert response.operation.id == operation_id + def test_operation_in_list_schema_is_valid(): operation_id = "7ac667f0-fd3f-4a6c-815b-82d0cb7a2132" sample_data = { From c81821fce6a322846d7959d9252baa015fc6b11f Mon Sep 17 00:00:00 2001 From: James Chapman Date: Fri, 6 Feb 2026 14:37:32 +0000 Subject: [PATCH 3/5] add link --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06ac541d88..d9ad60f0df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ ENHANCEMENTS: BUG FIXES: * Fix test function get_sample_operation step params. ([#4684](https://github.com/microsoft/AzureTRE/issues/4864)) -* Fix airlock request sample data fields and enum values. +* Fix airlock request sample data fields and enum values. ([#4866](https://github.com/microsoft/AzureTRE/issues/4866)) ## 0.27.0 (February 5, 2026) **BREAKING CHANGES** From 6556cb16350a6e6824879c47551b7779f120827f Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 10 Feb 2026 10:47:01 +0000 Subject: [PATCH 4/5] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77211aec75..405133f7a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ ENHANCEMENTS: BUG FIXES: * Fix test function get_sample_operation step params. ([#4684](https://github.com/microsoft/AzureTRE/issues/4864)) -* Fix airlock request sample data fields and enum values. ([#4866](https://github.com/microsoft/AzureTRE/issues/4866)) +* Fix test airlock request sample data fields and enum values. ([#4866](https://github.com/microsoft/AzureTRE/issues/4866)) * Fix property substitution not occuring where there is only a main step in the pipeline ([#4824](https://github.com/microsoft/AzureTRE/issues/4824)) * Fix Mysql template ignored storage_mb ([#4846](https://github.com/microsoft/AzureTRE/issues/4846)) * Fix duplicate `TOPIC_SUBSCRIPTION_NAME` in `core/terraform/airlock/airlock_processor.tf` ([#4847](https://github.com/microsoft/AzureTRE/pull/4847)) From b84f896e061b0abdafa6d6a61a66ed3179a48188 Mon Sep 17 00:00:00 2001 From: James Chapman <196318169+JC-wk@users.noreply.github.com> Date: Wed, 11 Feb 2026 09:43:36 +0000 Subject: [PATCH 5/5] Update CHANGELOG.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bdbd25321..2975f8af9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ ENHANCEMENTS: * Pass OIDC vars directly to the devcontainer ([#4871](https://github.com/microsoft/AzureTRE/issues/4871)) BUG FIXES: -* Fix test function get_sample_operation step params. ([#4684](https://github.com/microsoft/AzureTRE/issues/4864)) +* Fix OpenAPI/schema sample generation for `get_sample_operation` step parameters. ([#4864](https://github.com/microsoft/AzureTRE/issues/4864)) * Fix test airlock request sample data fields and enum values. ([#4866](https://github.com/microsoft/AzureTRE/issues/4866)) * Fix property substitution not occuring where there is only a main step in the pipeline ([#4824](https://github.com/microsoft/AzureTRE/issues/4824)) * Fix Mysql template ignored storage_mb ([#4846](https://github.com/microsoft/AzureTRE/issues/4846))