Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Props with underscores in ExtraTypes not translated correctly to camelCase in C# and Typescript #1786

Closed
ringods opened this issue Mar 24, 2024 · 6 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed

Comments

@ringods
Copy link
Member

ringods commented Mar 24, 2024

What happened?

For the Talos package, I replace a JSON string property with nested types defined in ExtraTypes. Some of the types have property names with an underscore. In the generated C# and Typescript SDKs, these properties are not converted to the usual camel cased property names.

Example

an ExtraType in resources.go

https://github.com/pulumiverse/pulumi-talos/blob/366f84ccb283fffd12278d52d27765cdfdd8e25f/provider/resources.go#L112-L121

generated C# code

https://github.com/pulumiverse/pulumi-talos/blob/366f84ccb283fffd12278d52d27765cdfdd8e25f/sdk/dotnet/Machine/Inputs/SecretsArgs.cs#L19-L49
https://github.com/pulumiverse/pulumi-talos/blob/366f84ccb283fffd12278d52d27765cdfdd8e25f/sdk/dotnet/Machine/Outputs/SecretsResult.cs#L20-L27

generated Typescript code

https://github.com/pulumiverse/pulumi-talos/blob/366f84ccb283fffd12278d52d27765cdfdd8e25f/sdk/nodejs/types/input.ts#L425-L434
https://github.com/pulumiverse/pulumi-talos/blob/366f84ccb283fffd12278d52d27765cdfdd8e25f/sdk/nodejs/types/output.ts#L292-L301

Output of pulumi about

N/A. All build dependencies can be seen in https://github.com/pulumiverse/pulumi-talos

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@ringods ringods added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Mar 24, 2024
@iwahbe
Copy link
Member

iwahbe commented Mar 26, 2024

Hey @ringods. The ExtraTypes field in ProviderInfo is injected directly into the generated Pulumi schema, which means that the type names need to be in Pulumi's capitalization system (camelCase) for word breaks to be detected.

In your case, that means changing bootstrap_token to bootstrapToken, secretbox_encryption_secret to secretboxEncryptionSecret, k8s_aggregator to k8sAggregator, ect.

@iwahbe iwahbe added resolution/by-design This issue won't be fixed because the functionality is working as designed and removed needs-triage Needs attention from the triage team labels Mar 26, 2024
@iwahbe iwahbe closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2024
@ringods
Copy link
Member Author

ringods commented Mar 26, 2024

@iwahbe thanks for the feedback. I thought I had to use the Terraform property names.

@iwahbe
Copy link
Member

iwahbe commented Mar 27, 2024

@iwahbe thanks for the feedback. I thought I had to use the Terraform property names.

You do for Resources (tf domain), but ExtraResources, ExtraTypes, etc are in the pulumi domain. I've made that mistake too.

@ringods
Copy link
Member Author

ringods commented Mar 27, 2024

You do for Resources (tf domain), but ExtraResources, ExtraTypes, etc are in the pulumi domain. I've made that mistake too.

Can you add this to the docs somewhere?

@iwahbe
Copy link
Member

iwahbe commented Mar 27, 2024

You do for Resources (tf domain), but ExtraResources, ExtraTypes, etc are in the pulumi domain. I've made that mistake too.

Can you add this to the docs somewhere?

Would the docs on the fields ProviderInfo.{Resources,Datasources,Extra*} work?

@ringods
Copy link
Member Author

ringods commented Apr 2, 2024

If you would link from a Markdown file to these sources, I think so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed
Projects
None yet
Development

No branches or pull requests

2 participants