diff --git a/providers/pulumi_wasm_provider_typesystem_rust/src/lib.rs b/providers/pulumi_wasm_provider_typesystem_rust/src/lib.rs index 56f97604..c76535d8 100644 --- a/providers/pulumi_wasm_provider_typesystem_rust/src/lib.rs +++ b/providers/pulumi_wasm_provider_typesystem_rust/src/lib.rs @@ -20,5 +20,5 @@ mod bindings { fn into_domain(output: WitOutput) -> Output { unsafe { Output::::new_from_handle(output) } } -pulumi_wasm_provider_common::generate_string_const!(ConstString_1, "1"); -pulumi_wasm_provider_common::generate_string_const!(ConstString_2, "2"); +pulumi_wasm_provider_common::generate_string_const!(ConstString1, "1"); +pulumi_wasm_provider_common::generate_string_const!(ConstString2, "2"); diff --git a/providers/pulumi_wasm_provider_typesystem_rust/src/types/union_case_with_const_1.rs b/providers/pulumi_wasm_provider_typesystem_rust/src/types/union_case_with_const_1.rs index 96671d2f..8dbe92ed 100644 --- a/providers/pulumi_wasm_provider_typesystem_rust/src/types/union_case_with_const_1.rs +++ b/providers/pulumi_wasm_provider_typesystem_rust/src/types/union_case_with_const_1.rs @@ -3,7 +3,7 @@ pub struct UnionCaseWithConst1 { #[builder(into, default)] #[serde(rename = "field")] - pub r#field: Box, + pub r#field: Box, #[builder(into)] #[serde(rename = "field1")] pub r#field_1: Box, diff --git a/providers/pulumi_wasm_provider_typesystem_rust/src/types/union_case_with_const_2.rs b/providers/pulumi_wasm_provider_typesystem_rust/src/types/union_case_with_const_2.rs index 0d20c387..8226c097 100644 --- a/providers/pulumi_wasm_provider_typesystem_rust/src/types/union_case_with_const_2.rs +++ b/providers/pulumi_wasm_provider_typesystem_rust/src/types/union_case_with_const_2.rs @@ -3,7 +3,7 @@ pub struct UnionCaseWithConst2 { #[builder(into, default)] #[serde(rename = "field")] - pub r#field: Box, + pub r#field: Box, #[builder(into)] #[serde(rename = "field2")] pub r#field_2: Box, diff --git a/pulumi_wasm_generator_lib/src/code_generation/yaml/model.rs b/pulumi_wasm_generator_lib/src/code_generation/yaml/model.rs index d298088b..31537ef4 100644 --- a/pulumi_wasm_generator_lib/src/code_generation/yaml/model.rs +++ b/pulumi_wasm_generator_lib/src/code_generation/yaml/model.rs @@ -195,7 +195,7 @@ fn remove_option(type_: &Type) -> TypeWithoutOption { Type::Integer => TypeWithoutOption::Integer, Type::Number => TypeWithoutOption::Number, Type::String => TypeWithoutOption::String, - Type::ConstString(s) => TypeWithoutOption::String, + Type::ConstString(_) => TypeWithoutOption::String, Type::Array(a) => TypeWithoutOption::Array(Box::new(remove_option(a))), Type::Object(o) => TypeWithoutOption::Object(Box::new(remove_option(o))), Type::Ref(r) => TypeWithoutOption::Ref(r.clone()), diff --git a/pulumi_wasm_generator_lib/src/model.rs b/pulumi_wasm_generator_lib/src/model.rs index fcef9c9d..8963ced6 100644 --- a/pulumi_wasm_generator_lib/src/model.rs +++ b/pulumi_wasm_generator_lib/src/model.rs @@ -1,6 +1,7 @@ use crate::utils::{escape_rust_name, escape_wit_identifier, replace_multiple_dashes}; use anyhow::{Context, Result}; use convert_case::Case; +use convert_case::Case::UpperCamel; use convert_case::Casing; use std::collections::BTreeMap; @@ -49,7 +50,9 @@ impl Type { .collect::>() .join(", ") ), - Type::ConstString(s) => format!("crate::ConstString_{}", s).to_string(), + Type::ConstString(s) => { + format!("crate::ConstString{}", s.to_case(UpperCamel)).to_string() + } } } diff --git a/pulumi_wasm_generator_lib/src/output/rust/lib.rs.handlebars b/pulumi_wasm_generator_lib/src/output/rust/lib.rs.handlebars index bee10175..d3f4d29b 100644 --- a/pulumi_wasm_generator_lib/src/output/rust/lib.rs.handlebars +++ b/pulumi_wasm_generator_lib/src/output/rust/lib.rs.handlebars @@ -36,5 +36,5 @@ fn into_domain(output: WitOutput) -> Output { } {{/if}} {{#each package.const_strings}} -pulumi_wasm_provider_common::generate_string_const!(ConstString_{{&this}}, "{{&this}}"); +pulumi_wasm_provider_common::generate_string_const!(ConstString{{&this}}, "{{&this}}"); {{/each}} \ No newline at end of file diff --git a/pulumi_wasm_generator_lib/src/output/rust/source_code_librs.rs b/pulumi_wasm_generator_lib/src/output/rust/source_code_librs.rs index b0e73eb1..67b6e97a 100644 --- a/pulumi_wasm_generator_lib/src/output/rust/source_code_librs.rs +++ b/pulumi_wasm_generator_lib/src/output/rust/source_code_librs.rs @@ -1,5 +1,7 @@ use crate::model::GlobalType; use crate::output::get_main_version; +use convert_case::Case::UpperCamel; +use convert_case::Casing; use handlebars::Handlebars; use itertools::Itertools; use serde::Serialize; @@ -59,7 +61,11 @@ fn find_consts(package: &crate::model::Package) -> Vec { } } } - consts.into_iter().sorted().collect() + consts + .into_iter() + .map(|s| s.to_case(UpperCamel)) + .sorted() + .collect() } pub(crate) fn generate_source_code(package: &crate::model::Package) -> String { diff --git a/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/lib.rs b/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/lib.rs index b570f7df..60ff489c 100644 --- a/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/lib.rs +++ b/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/lib.rs @@ -20,5 +20,5 @@ mod bindings { fn into_domain(output: WitOutput) -> Output { unsafe { Output::::new_from_handle(output) } } -pulumi_wasm_provider_common::generate_string_const!(ConstString_Pav2, "Pav2"); -pulumi_wasm_provider_common::generate_string_const!(ConstString_Purchase, "Purchase"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringPav2, "Pav2"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringPurchase, "Purchase"); diff --git a/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/types/pav_2_meter_details_response.rs b/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/types/pav_2_meter_details_response.rs index b7b4ddf3..d0ba30e5 100644 --- a/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/types/pav_2_meter_details_response.rs +++ b/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/types/pav_2_meter_details_response.rs @@ -7,7 +7,7 @@ pub struct Pav2MeterDetailsResponse { /// Expected value is 'Pav2'. #[builder(into, default)] #[serde(rename = "billingType")] - pub r#billing_type: Box, + pub r#billing_type: Box, /// Charging type. #[builder(into)] #[serde(rename = "chargingType")] diff --git a/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/types/purchase_meter_details_response.rs b/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/types/purchase_meter_details_response.rs index bedad2cc..83e74f2a 100644 --- a/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/types/purchase_meter_details_response.rs +++ b/pulumi_wasm_generator_lib/tests/output/output-funcs-edgeorder/lib/src/types/purchase_meter_details_response.rs @@ -7,7 +7,7 @@ pub struct PurchaseMeterDetailsResponse { /// Expected value is 'Purchase'. #[builder(into, default)] #[serde(rename = "billingType")] - pub r#billing_type: Box, + pub r#billing_type: Box, /// Charging type. #[builder(into)] #[serde(rename = "chargingType")] diff --git a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/function/func_with_const_input.rs b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/function/func_with_const_input.rs index c77b8d6c..6dc8a5da 100644 --- a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/function/func_with_const_input.rs +++ b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/function/func_with_const_input.rs @@ -4,7 +4,7 @@ #[builder(finish_fn = build_struct)] pub struct FuncWithConstInputArgs { #[builder(into, default)] - pub plain_input: pulumi_wasm_rust::Output>, + pub plain_input: pulumi_wasm_rust::Output>, } pub struct FuncWithConstInputResult { diff --git a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/lib.rs b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/lib.rs index b1e7bf16..7a928d86 100644 --- a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/lib.rs +++ b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/lib.rs @@ -20,8 +20,8 @@ mod bindings { fn into_domain(output: WitOutput) -> Output { unsafe { Output::::new_from_handle(output) } } -pulumi_wasm_provider_common::generate_string_const!(ConstString_Environment, "Environment"); -pulumi_wasm_provider_common::generate_string_const!(ConstString_Folder, "Folder"); -pulumi_wasm_provider_common::generate_string_const!(ConstString_Package, "Package"); -pulumi_wasm_provider_common::generate_string_const!(ConstString_Project, "Project"); -pulumi_wasm_provider_common::generate_string_const!(ConstString_fixed, "fixed"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringEnvironment, "Environment"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringFixed, "Fixed"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringFolder, "Folder"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringPackage, "Package"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringProject, "Project"); diff --git a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_environment_response.rs b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_environment_response.rs index c015e364..8da0dee9 100644 --- a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_environment_response.rs +++ b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_environment_response.rs @@ -23,7 +23,7 @@ pub struct SsisEnvironmentResponse { /// Expected value is 'Environment'. #[builder(into, default)] #[serde(rename = "type")] - pub r#type: Box, + pub r#type: Box, /// Variable in environment #[builder(into, default)] #[serde(rename = "variables")] diff --git a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_folder_response.rs b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_folder_response.rs index fdff226b..07a02298 100644 --- a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_folder_response.rs +++ b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_folder_response.rs @@ -19,5 +19,5 @@ pub struct SsisFolderResponse { /// Expected value is 'Folder'. #[builder(into, default)] #[serde(rename = "type")] - pub r#type: Box, + pub r#type: Box, } diff --git a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_package_response.rs b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_package_response.rs index 86b5cf2f..e3bd4c51 100644 --- a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_package_response.rs +++ b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_package_response.rs @@ -35,5 +35,5 @@ pub struct SsisPackageResponse { /// Expected value is 'Package'. #[builder(into, default)] #[serde(rename = "type")] - pub r#type: Box, + pub r#type: Box, } diff --git a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_project_response.rs b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_project_response.rs index ed930c98..102cf1a0 100644 --- a/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_project_response.rs +++ b/pulumi_wasm_generator_lib/tests/output/output-funcs/lib/src/types/ssis_project_response.rs @@ -31,7 +31,7 @@ pub struct SsisProjectResponse { /// Expected value is 'Project'. #[builder(into, default)] #[serde(rename = "type")] - pub r#type: Box, + pub r#type: Box, /// Project version. #[builder(into, default)] #[serde(rename = "version")] diff --git a/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/lib.rs b/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/lib.rs index e9f2db7e..c9ee6a4e 100644 --- a/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/lib.rs +++ b/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/lib.rs @@ -20,5 +20,5 @@ mod bindings { fn into_domain(output: WitOutput) -> Output { unsafe { Output::::new_from_handle(output) } } -pulumi_wasm_provider_common::generate_string_const!(ConstString_PointInTimeRestore, "PointInTimeRestore"); -pulumi_wasm_provider_common::generate_string_const!(ConstString_Replica, "Replica"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringPointInTimeRestore, "PointInTimeRestore"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringReplica, "Replica"); diff --git a/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/types/server_properties_for_replica.rs b/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/types/server_properties_for_replica.rs index 2ea086d4..50b8df8e 100644 --- a/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/types/server_properties_for_replica.rs +++ b/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/types/server_properties_for_replica.rs @@ -3,7 +3,7 @@ pub struct ServerPropertiesForReplica { #[builder(into, default)] #[serde(rename = "createMode")] - pub r#create_mode: Box, + pub r#create_mode: Box, #[builder(into, default)] #[serde(rename = "version")] pub r#version: Box>, diff --git a/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/types/server_properties_for_restore.rs b/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/types/server_properties_for_restore.rs index b338384d..04592a2e 100644 --- a/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/types/server_properties_for_restore.rs +++ b/pulumi_wasm_generator_lib/tests/output/unions-inline/lib/src/types/server_properties_for_restore.rs @@ -3,7 +3,7 @@ pub struct ServerPropertiesForRestore { #[builder(into, default)] #[serde(rename = "createMode")] - pub r#create_mode: Box, + pub r#create_mode: Box, #[builder(into)] #[serde(rename = "restorePointInTime")] pub r#restore_point_in_time: Box, diff --git a/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/lib.rs b/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/lib.rs index e9f2db7e..c9ee6a4e 100644 --- a/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/lib.rs +++ b/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/lib.rs @@ -20,5 +20,5 @@ mod bindings { fn into_domain(output: WitOutput) -> Output { unsafe { Output::::new_from_handle(output) } } -pulumi_wasm_provider_common::generate_string_const!(ConstString_PointInTimeRestore, "PointInTimeRestore"); -pulumi_wasm_provider_common::generate_string_const!(ConstString_Replica, "Replica"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringPointInTimeRestore, "PointInTimeRestore"); +pulumi_wasm_provider_common::generate_string_const!(ConstStringReplica, "Replica"); diff --git a/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/types/server_properties_for_replica.rs b/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/types/server_properties_for_replica.rs index 2ea086d4..50b8df8e 100644 --- a/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/types/server_properties_for_replica.rs +++ b/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/types/server_properties_for_replica.rs @@ -3,7 +3,7 @@ pub struct ServerPropertiesForReplica { #[builder(into, default)] #[serde(rename = "createMode")] - pub r#create_mode: Box, + pub r#create_mode: Box, #[builder(into, default)] #[serde(rename = "version")] pub r#version: Box>, diff --git a/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/types/server_properties_for_restore.rs b/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/types/server_properties_for_restore.rs index b338384d..04592a2e 100644 --- a/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/types/server_properties_for_restore.rs +++ b/pulumi_wasm_generator_lib/tests/output/unions-inside-arrays/lib/src/types/server_properties_for_restore.rs @@ -3,7 +3,7 @@ pub struct ServerPropertiesForRestore { #[builder(into, default)] #[serde(rename = "createMode")] - pub r#create_mode: Box, + pub r#create_mode: Box, #[builder(into)] #[serde(rename = "restorePointInTime")] pub r#restore_point_in_time: Box,