From 8d9cdf74b9407ba9254474f72336ff2e5f2a26a4 Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Tue, 26 Nov 2024 20:24:13 -0800 Subject: [PATCH] chore: make actor create runtime optional & fix inconsistent snake case in api --- packages/api/actor/src/route/actors.rs | 6 +++--- packages/services/build/ops/create/src/lib.rs | 3 +-- sdks/api/fern/definition/actor/__package__.yml | 8 ++++---- sdks/api/full/openapi/openapi.yml | 1 - sdks/api/full/openapi_compat/openapi.yml | 1 - sdks/api/full/rust-cli/docs/ActorCreateActorRequest.md | 2 +- .../rust-cli/src/models/actor_create_actor_request.rs | 8 ++++---- sdks/api/full/rust/docs/ActorCreateActorRequest.md | 2 +- .../full/rust/src/models/actor_create_actor_request.rs | 7 +++---- .../typescript/src/api/resources/actor/client/Client.ts | 4 +--- .../actor/client/requests/CreateActorRequestQuery.ts | 4 +--- sdks/api/runtime/openapi/openapi.yml | 1 - sdks/api/runtime/openapi_compat/openapi.yml | 1 - sdks/api/runtime/rust/docs/ActorCreateActorRequest.md | 2 +- .../runtime/rust/src/models/actor_create_actor_request.rs | 8 ++++---- .../typescript/src/api/resources/actor/client/Client.ts | 4 +--- .../actor/client/requests/CreateActorRequestQuery.ts | 4 +--- 17 files changed, 26 insertions(+), 40 deletions(-) diff --git a/packages/api/actor/src/route/actors.rs b/packages/api/actor/src/route/actors.rs index 82ec24047a..0158d500e8 100644 --- a/packages/api/actor/src/route/actors.rs +++ b/packages/api/actor/src/route/actors.rs @@ -158,7 +158,7 @@ pub async fn create( // args: body.runtime.arguments.unwrap_or_default(), args: Vec::new(), network_mode: network.mode.unwrap_or_default().api_into(), - environment: body.runtime.environment.unwrap_or_default(), + environment: body.runtime.and_then(|r| r.environment).unwrap_or_default(), network_ports: unwrap!(network .ports .unwrap_or_default() @@ -331,9 +331,9 @@ pub async fn create_deprecated( cpu: body.resources.cpu, memory: body.resources.memory, }), - runtime: Box::new(models::ActorCreateActorRuntimeRequest { + runtime: Some(Box::new(models::ActorCreateActorRuntimeRequest { environment: body.runtime.environment, - }), + })), build: Some(body.runtime.build), build_tags: None, tags: body.tags, diff --git a/packages/services/build/ops/create/src/lib.rs b/packages/services/build/ops/create/src/lib.rs index 1c3014d280..8514654c26 100644 --- a/packages/services/build/ops/create/src/lib.rs +++ b/packages/services/build/ops/create/src/lib.rs @@ -27,8 +27,7 @@ async fn handle( .await?; let game = game_res.games.first(); ensure!(game.is_some(), "game not found"); - } - else if let Some(env_id) = env_id { + } else if let Some(env_id) = env_id { let env_res = op!([ctx] game_namespace_get { namespace_ids: vec![env_id.into()], }) diff --git a/sdks/api/fern/definition/actor/__package__.yml b/sdks/api/fern/definition/actor/__package__.yml index 4ab34f2bbf..2b4a7b9c56 100644 --- a/sdks/api/fern/definition/actor/__package__.yml +++ b/sdks/api/fern/definition/actor/__package__.yml @@ -111,8 +111,8 @@ types: region: optional tags: unknown build: optional - buildTags: optional - runtime: CreateActorRuntimeRequest + build_tags: optional + runtime: optional network: optional resources: commons.Resources lifecycle: optional @@ -145,7 +145,7 @@ types: UpgradeActorRequest: properties: build: optional - buildTags: optional + build_tags: optional UpgradeActorResponse: properties: {} @@ -154,7 +154,7 @@ types: properties: tags: unknown build: optional - buildTags: optional + build_tags: optional UpgradeAllActorsResponse: properties: diff --git a/sdks/api/full/openapi/openapi.yml b/sdks/api/full/openapi/openapi.yml index 87b0ceedc8..c820eebfaa 100644 --- a/sdks/api/full/openapi/openapi.yml +++ b/sdks/api/full/openapi/openapi.yml @@ -8723,7 +8723,6 @@ components: $ref: '#/components/schemas/ActorLifecycle' required: - tags - - runtime - resources ActorCreateActorRuntimeRequest: type: object diff --git a/sdks/api/full/openapi_compat/openapi.yml b/sdks/api/full/openapi_compat/openapi.yml index d1b3cc22eb..9f16a6ab9c 100644 --- a/sdks/api/full/openapi_compat/openapi.yml +++ b/sdks/api/full/openapi_compat/openapi.yml @@ -112,7 +112,6 @@ components: tags: {} required: - tags - - runtime - resources type: object ActorCreateActorResponse: diff --git a/sdks/api/full/rust-cli/docs/ActorCreateActorRequest.md b/sdks/api/full/rust-cli/docs/ActorCreateActorRequest.md index ec2884d7d8..2d3e08ef69 100644 --- a/sdks/api/full/rust-cli/docs/ActorCreateActorRequest.md +++ b/sdks/api/full/rust-cli/docs/ActorCreateActorRequest.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **network** | Option<[**crate::models::ActorCreateActorNetworkRequest**](ActorCreateActorNetworkRequest.md)> | | [optional] **region** | Option<**String**> | | [optional] **resources** | [**crate::models::ActorResources**](ActorResources.md) | | -**runtime** | [**crate::models::ActorCreateActorRuntimeRequest**](ActorCreateActorRuntimeRequest.md) | | +**runtime** | Option<[**crate::models::ActorCreateActorRuntimeRequest**](ActorCreateActorRuntimeRequest.md)> | | [optional] **tags** | Option<[**serde_json::Value**](.md)> | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/sdks/api/full/rust-cli/src/models/actor_create_actor_request.rs b/sdks/api/full/rust-cli/src/models/actor_create_actor_request.rs index 6652a8d951..1f380befb8 100644 --- a/sdks/api/full/rust-cli/src/models/actor_create_actor_request.rs +++ b/sdks/api/full/rust-cli/src/models/actor_create_actor_request.rs @@ -25,14 +25,14 @@ pub struct ActorCreateActorRequest { pub region: Option, #[serde(rename = "resources")] pub resources: Box, - #[serde(rename = "runtime")] - pub runtime: Box, + #[serde(rename = "runtime", skip_serializing_if = "Option::is_none")] + pub runtime: Option>, #[serde(rename = "tags", deserialize_with = "Option::deserialize")] pub tags: Option, } impl ActorCreateActorRequest { - pub fn new(resources: crate::models::ActorResources, runtime: crate::models::ActorCreateActorRuntimeRequest, tags: Option) -> ActorCreateActorRequest { + pub fn new(resources: crate::models::ActorResources, tags: Option) -> ActorCreateActorRequest { ActorCreateActorRequest { build: None, build_tags: None, @@ -40,7 +40,7 @@ impl ActorCreateActorRequest { network: None, region: None, resources: Box::new(resources), - runtime: Box::new(runtime), + runtime: None, tags, } } diff --git a/sdks/api/full/rust/docs/ActorCreateActorRequest.md b/sdks/api/full/rust/docs/ActorCreateActorRequest.md index ec2884d7d8..2d3e08ef69 100644 --- a/sdks/api/full/rust/docs/ActorCreateActorRequest.md +++ b/sdks/api/full/rust/docs/ActorCreateActorRequest.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **network** | Option<[**crate::models::ActorCreateActorNetworkRequest**](ActorCreateActorNetworkRequest.md)> | | [optional] **region** | Option<**String**> | | [optional] **resources** | [**crate::models::ActorResources**](ActorResources.md) | | -**runtime** | [**crate::models::ActorCreateActorRuntimeRequest**](ActorCreateActorRuntimeRequest.md) | | +**runtime** | Option<[**crate::models::ActorCreateActorRuntimeRequest**](ActorCreateActorRuntimeRequest.md)> | | [optional] **tags** | Option<[**serde_json::Value**](.md)> | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/sdks/api/full/rust/src/models/actor_create_actor_request.rs b/sdks/api/full/rust/src/models/actor_create_actor_request.rs index 4eaea32d1a..cd0ab71587 100644 --- a/sdks/api/full/rust/src/models/actor_create_actor_request.rs +++ b/sdks/api/full/rust/src/models/actor_create_actor_request.rs @@ -27,8 +27,8 @@ pub struct ActorCreateActorRequest { pub region: Option, #[serde(rename = "resources")] pub resources: Box, - #[serde(rename = "runtime")] - pub runtime: Box, + #[serde(rename = "runtime", skip_serializing_if = "Option::is_none")] + pub runtime: Option>, #[serde(rename = "tags", deserialize_with = "Option::deserialize")] pub tags: Option, } @@ -36,7 +36,6 @@ pub struct ActorCreateActorRequest { impl ActorCreateActorRequest { pub fn new( resources: crate::models::ActorResources, - runtime: crate::models::ActorCreateActorRuntimeRequest, tags: Option, ) -> ActorCreateActorRequest { ActorCreateActorRequest { @@ -46,7 +45,7 @@ impl ActorCreateActorRequest { network: None, region: None, resources: Box::new(resources), - runtime: Box::new(runtime), + runtime: None, tags, } } diff --git a/sdks/api/full/typescript/src/api/resources/actor/client/Client.ts b/sdks/api/full/typescript/src/api/resources/actor/client/Client.ts index 98ab2b6551..7dc4172320 100644 --- a/sdks/api/full/typescript/src/api/resources/actor/client/Client.ts +++ b/sdks/api/full/typescript/src/api/resources/actor/client/Client.ts @@ -370,9 +370,7 @@ export class Actor { * "key": "value" * }, * runtime: { - * environment: { - * "string": "string" - * } + * environment: {} * }, * network: { * mode: "bridge", diff --git a/sdks/api/full/typescript/src/api/resources/actor/client/requests/CreateActorRequestQuery.ts b/sdks/api/full/typescript/src/api/resources/actor/client/requests/CreateActorRequestQuery.ts index 22d3c322e7..0e7cecdd75 100644 --- a/sdks/api/full/typescript/src/api/resources/actor/client/requests/CreateActorRequestQuery.ts +++ b/sdks/api/full/typescript/src/api/resources/actor/client/requests/CreateActorRequestQuery.ts @@ -19,9 +19,7 @@ import * as RivetClient from "../../../../index"; * "key": "value" * }, * runtime: { - * environment: { - * "string": "string" - * } + * environment: {} * }, * network: { * mode: "bridge", diff --git a/sdks/api/runtime/openapi/openapi.yml b/sdks/api/runtime/openapi/openapi.yml index 185e9ab96f..ed45d063f9 100644 --- a/sdks/api/runtime/openapi/openapi.yml +++ b/sdks/api/runtime/openapi/openapi.yml @@ -939,7 +939,6 @@ components: $ref: '#/components/schemas/ActorLifecycle' required: - tags - - runtime - resources ActorCreateActorRuntimeRequest: type: object diff --git a/sdks/api/runtime/openapi_compat/openapi.yml b/sdks/api/runtime/openapi_compat/openapi.yml index 787eecb4f4..adda8518b3 100644 --- a/sdks/api/runtime/openapi_compat/openapi.yml +++ b/sdks/api/runtime/openapi_compat/openapi.yml @@ -110,7 +110,6 @@ components: tags: {} required: - tags - - runtime - resources type: object ActorCreateActorResponse: diff --git a/sdks/api/runtime/rust/docs/ActorCreateActorRequest.md b/sdks/api/runtime/rust/docs/ActorCreateActorRequest.md index ec2884d7d8..2d3e08ef69 100644 --- a/sdks/api/runtime/rust/docs/ActorCreateActorRequest.md +++ b/sdks/api/runtime/rust/docs/ActorCreateActorRequest.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **network** | Option<[**crate::models::ActorCreateActorNetworkRequest**](ActorCreateActorNetworkRequest.md)> | | [optional] **region** | Option<**String**> | | [optional] **resources** | [**crate::models::ActorResources**](ActorResources.md) | | -**runtime** | [**crate::models::ActorCreateActorRuntimeRequest**](ActorCreateActorRuntimeRequest.md) | | +**runtime** | Option<[**crate::models::ActorCreateActorRuntimeRequest**](ActorCreateActorRuntimeRequest.md)> | | [optional] **tags** | Option<[**serde_json::Value**](.md)> | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/sdks/api/runtime/rust/src/models/actor_create_actor_request.rs b/sdks/api/runtime/rust/src/models/actor_create_actor_request.rs index 6652a8d951..1f380befb8 100644 --- a/sdks/api/runtime/rust/src/models/actor_create_actor_request.rs +++ b/sdks/api/runtime/rust/src/models/actor_create_actor_request.rs @@ -25,14 +25,14 @@ pub struct ActorCreateActorRequest { pub region: Option, #[serde(rename = "resources")] pub resources: Box, - #[serde(rename = "runtime")] - pub runtime: Box, + #[serde(rename = "runtime", skip_serializing_if = "Option::is_none")] + pub runtime: Option>, #[serde(rename = "tags", deserialize_with = "Option::deserialize")] pub tags: Option, } impl ActorCreateActorRequest { - pub fn new(resources: crate::models::ActorResources, runtime: crate::models::ActorCreateActorRuntimeRequest, tags: Option) -> ActorCreateActorRequest { + pub fn new(resources: crate::models::ActorResources, tags: Option) -> ActorCreateActorRequest { ActorCreateActorRequest { build: None, build_tags: None, @@ -40,7 +40,7 @@ impl ActorCreateActorRequest { network: None, region: None, resources: Box::new(resources), - runtime: Box::new(runtime), + runtime: None, tags, } } diff --git a/sdks/api/runtime/typescript/src/api/resources/actor/client/Client.ts b/sdks/api/runtime/typescript/src/api/resources/actor/client/Client.ts index 27ada30cea..810cf8def7 100644 --- a/sdks/api/runtime/typescript/src/api/resources/actor/client/Client.ts +++ b/sdks/api/runtime/typescript/src/api/resources/actor/client/Client.ts @@ -370,9 +370,7 @@ export class Actor { * "key": "value" * }, * runtime: { - * environment: { - * "string": "string" - * } + * environment: {} * }, * network: { * mode: "bridge", diff --git a/sdks/api/runtime/typescript/src/api/resources/actor/client/requests/CreateActorRequestQuery.ts b/sdks/api/runtime/typescript/src/api/resources/actor/client/requests/CreateActorRequestQuery.ts index 22d3c322e7..0e7cecdd75 100644 --- a/sdks/api/runtime/typescript/src/api/resources/actor/client/requests/CreateActorRequestQuery.ts +++ b/sdks/api/runtime/typescript/src/api/resources/actor/client/requests/CreateActorRequestQuery.ts @@ -19,9 +19,7 @@ import * as RivetClient from "../../../../index"; * "key": "value" * }, * runtime: { - * environment: { - * "string": "string" - * } + * environment: {} * }, * network: { * mode: "bridge",