From 83f38f4cf72549b7cb37b85c164422bffa120e55 Mon Sep 17 00:00:00 2001 From: Dan Jones <danjon@noc.ac.uk> Date: Mon, 16 Sep 2024 14:02:48 +0100 Subject: [PATCH] refactor: move oneof for plan id --- formats/mission_plan.py | 39 +++++++++++++++++++++++---------------- project/soar/swagger.json | 23 +++++++++++++++-------- 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/formats/mission_plan.py b/formats/mission_plan.py index 0f58208..fe46d11 100644 --- a/formats/mission_plan.py +++ b/formats/mission_plan.py @@ -110,22 +110,6 @@ mission_plan_schema = { "example": "mission_plan", "enum": ["mission_plan"], }, - "autonomy_engine_plan_ID": { - "oneOf": [ - { - "type": "string", - "format": "uuid", - "description": "Unique identifier for this plan" - + "generated by the Autonomy Engine", - }, - { - "type": "integer", - "description": "Unique identifier for this plan" - + "generated by the Autonomy Engine", - "example": 3, - }, - ] - }, "platform_ID": { "type": "string", "description": "Unique identifier for this platform", @@ -143,6 +127,29 @@ mission_plan_schema = { "items": action_schema, }, }, + "oneOf": [ + { + "properties": { + "autonomy_engine_plan_ID": { + "type": "string", + "format": "uuid", + "pattern": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", + "description": "Unique identifier for this plan" + + "generated by the Autonomy Engine", + }, + }, + }, + { + "properties": { + "autonomy_engine_plan_ID": { + "type": "integer", + "description": "Unique identifier for this plan" + + "generated by the Autonomy Engine", + "example": 3, + }, + }, + }, + ], "required": [ "message_type", "autonomy_engine_plan_ID", diff --git a/project/soar/swagger.json b/project/soar/swagger.json index b2a1073..24eefcf 100644 --- a/project/soar/swagger.json +++ b/project/soar/swagger.json @@ -1528,21 +1528,28 @@ "type": "object" }, "mission_plan": { - "properties": { - "autonomy_engine_plan_ID": { - "oneOf": [ - { + "oneOf": [ + { + "properties": { + "autonomy_engine_plan_ID": { "description": "Unique identifier for this plangenerated by the Autonomy Engine", "format": "uuid", + "pattern": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", "type": "string" - }, - { + } + } + }, + { + "properties": { + "autonomy_engine_plan_ID": { "description": "Unique identifier for this plangenerated by the Autonomy Engine", "example": 3, "type": "integer" } - ] - }, + } + } + ], + "properties": { "emergency": { "default": false, "description": "To indicate if this is an emergency. true = emergency and false = no emergency", -- GitLab