From bb226373e6ad91706757dd3b6bc1de4f938e49a8 Mon Sep 17 00:00:00 2001 From: benjamaan476 Date: Fri, 19 Sep 2025 11:03:48 +0100 Subject: [PATCH 1/9] add SceneGetEntityIds --- modeling-cmds/src/def_enum.rs | 11 +++++++++++ modeling-cmds/src/ok_response.rs | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 3cff5e09..2652e6d4 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -1498,6 +1498,17 @@ define_modeling_cmd_enum! { pub filter: Vec, } + /// Get the all ids of a given entity type. + #[derive( + Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, + )] + #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] + #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] + pub struct SceneGetEntityIds { + /// The entity types to be queried. + pub filter: Vec, + } + /// Use orthographic projection. #[derive( Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index afa17422..19d95cff 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -544,6 +544,14 @@ define_ok_modeling_cmd_response_enum! { /// The type of the entity. pub entity_type: EntityType, } + + /// The response from the `SceneGetEntityIds` command. + #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] + pub struct SceneGetEntityIds { + /// The ids of the requested entities. + pub entity_ids: Vec, + } + /// The response from the `CurveGetControlPoints` command. #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] pub struct CurveGetControlPoints { From b851d236d32a4bc7af03d717baa536d167642db1 Mon Sep 17 00:00:00 2001 From: benjamaan476 Date: Fri, 19 Sep 2025 11:46:47 +0100 Subject: [PATCH 2/9] update return type --- modeling-cmds/src/ok_response.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index 19d95cff..da7a21f8 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -549,7 +549,7 @@ define_ok_modeling_cmd_response_enum! { #[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)] pub struct SceneGetEntityIds { /// The ids of the requested entities. - pub entity_ids: Vec, + pub entity_ids: Vec>, } /// The response from the `CurveGetControlPoints` command. From 6be4b4a6fe806238df4cb2d98b6a0a831f747171 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 2 Oct 2025 10:54:29 +0100 Subject: [PATCH 3/9] add skip and take for SceneGetEntityIds --- modeling-cmds/src/def_enum.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 48e91423..15a43642 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -1536,6 +1536,10 @@ define_modeling_cmd_enum! { pub struct SceneGetEntityIds { /// The entity types to be queried. pub filter: Vec, + /// Skip the first n returned ids. + pub skip: u32, + /// Take n ids after any ids skipped. + pub take: u32, } /// Use orthographic projection. From b384963baccb48895371776ee4ec30d27d1304a2 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 20 Oct 2025 09:53:17 +0100 Subject: [PATCH 4/9] redo openapi --- modeling-cmds/openapi/api.json | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 082e1a7e..145bcde0 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -5413,6 +5413,43 @@ "type" ] }, + { + "description": "Get the all ids of a given entity type.", + "type": "object", + "properties": { + "filter": { + "description": "The entity types to be queried.", + "type": "array", + "items": { + "$ref": "#/components/schemas/EntityType" + } + }, + "skip": { + "description": "Skip the first n returned ids.", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "take": { + "description": "Take n ids after any ids skipped.", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "type": { + "type": "string", + "enum": [ + "scene_get_entity_ids" + ] + } + }, + "required": [ + "filter", + "skip", + "take", + "type" + ] + }, { "description": "Use orthographic projection.", "type": "object", From 1b350639a290c11eba6a314d12e607be8585367a Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 20 Oct 2025 10:06:48 +0100 Subject: [PATCH 5/9] fix type in comment --- modeling-cmds/src/def_enum.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 15a43642..7131e4fe 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -1527,7 +1527,7 @@ define_modeling_cmd_enum! { pub filter: Vec, } - /// Get the all ids of a given entity type. + /// Get the ids of a given entity type. #[derive( Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, )] From a6ed54130339c7c9cffacf4cc28b868511052257 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 20 Oct 2025 10:08:31 +0100 Subject: [PATCH 6/9] redo openapi --- modeling-cmds/openapi/api.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 145bcde0..2766823c 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -5414,7 +5414,7 @@ ] }, { - "description": "Get the all ids of a given entity type.", + "description": "Get the ids of a given entity type.", "type": "object", "properties": { "filter": { From 022413b46e30f6fa7b6c73a67247a6cec885ce3d Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 20 Oct 2025 15:56:32 +0100 Subject: [PATCH 7/9] improve comments of skip and take --- modeling-cmds/src/def_enum.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 7131e4fe..9b8a4806 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -1536,9 +1536,12 @@ define_modeling_cmd_enum! { pub struct SceneGetEntityIds { /// The entity types to be queried. pub filter: Vec, - /// Skip the first n returned ids. + /// Skip the first n returned ids. If multiple filters are provided, this skip will + /// apply to each filter individually. pub skip: u32, - /// Take n ids after any ids skipped. + /// Take n ids after any ids skipped. This value must be greater than zero and not + /// exceed 1000. If multiple filtes are provided, this take will apply to each filter + /// individually. pub take: u32, } From b4d7aa6af60d3b39b346c2b44b9162b9c53e9a8d Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 20 Oct 2025 16:09:44 +0100 Subject: [PATCH 8/9] improve comments again and fix typo --- modeling-cmds/src/def_enum.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 9b8a4806..b6299be2 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -1540,8 +1540,9 @@ define_modeling_cmd_enum! { /// apply to each filter individually. pub skip: u32, /// Take n ids after any ids skipped. This value must be greater than zero and not - /// exceed 1000. If multiple filtes are provided, this take will apply to each filter - /// individually. + /// exceed 1000. If multiple filters are provided, this take will apply to each filter + /// individually. If there are fewer than `take` items of the provided filter type then the + /// returned list's length will be the smaller value. pub take: u32, } From 0bb17dd35db02736ae73e363884a8070949c7702 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 20 Oct 2025 16:42:21 +0100 Subject: [PATCH 9/9] enforce limits on openapi schema --- modeling-cmds/openapi/api.json | 7 ++++--- modeling-cmds/src/def_enum.rs | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 2766823c..81140b8a 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -5425,16 +5425,17 @@ } }, "skip": { - "description": "Skip the first n returned ids.", + "description": "Skip the first n returned ids. If multiple filters are provided, this skip will apply to each filter individually.", "type": "integer", "format": "uint32", "minimum": 0 }, "take": { - "description": "Take n ids after any ids skipped.", + "description": "Take n ids after any ids skipped. This value must be greater than zero and not exceed 1000. If multiple filters are provided, this take will apply to each filter individually. If there are fewer than `take` items of the provided filter type then the returned list's length will be the smaller value.", "type": "integer", "format": "uint32", - "minimum": 0 + "minimum": 1, + "maximum": 1000 }, "type": { "type": "string", diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index b6299be2..09e5197e 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -1543,6 +1543,7 @@ define_modeling_cmd_enum! { /// exceed 1000. If multiple filters are provided, this take will apply to each filter /// individually. If there are fewer than `take` items of the provided filter type then the /// returned list's length will be the smaller value. + #[schemars(range(min = 1, max = 1000))] pub take: u32, }