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

[codegen] Fix camel casing of punctuated properties #16197

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

blampe
Copy link
Contributor

@blampe blampe commented May 14, 2024

Description

Updates node and dotnet to use cgstrings.Camel in order to correctly remove punctuation.

Fixes #15874.

Refs

Checklist

  • I have run make tidy to update any new dependencies
  • I have run make lint to verify my code passes the lint check
    • I have formatted my code using gofumpt
  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change
  • Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version

@blampe blampe requested a review from a team as a code owner May 14, 2024 23:10
@blampe blampe requested a review from Zaid-Ajaj May 14, 2024 23:10
@pulumi-bot
Copy link
Contributor

pulumi-bot commented May 14, 2024

Changelog

[uncommitted] (2024-05-30)

Bug Fixes

  • [sdkgen/{nodejs},{dotnet}] Fix camel casing of punctuated properties
    #16197

[OutputType]
public sealed class Bar
{
public readonly string? Has-a-hyphen;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a valid C# identifier.

import * as outputs from "../types/output";

export interface Bar {
has-a-hyphen?: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a valid TS identifier

@Frassle
Copy link
Member

Frassle commented Jun 26, 2024

I'm not confident this is actually correct. I don't see annotations being emitted to tell the SDK to serialise/deserialise to the wire protocol with the hyphenated names.

There's also a bit of me that is not really keen on saying we support names like this in schema. I'd rather that the thing building the schema is responsible for coming up with "identifier like" names (e.g. fooBar, not foo-bar) rather than trying to make codegen deal with any possible string.

See https://docs.google.com/document/d/1ns07htpLjw0dJPn5p7TBPVULvwwYc1Pl7l1c1jdGXoY/edit#heading=h.cpxu86q7zc1s for some discussion we've had around property/type naming systems in the past.

This probably needs bringing to iac ideation meeting to be discussed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashed properties generate invalid Node & Dotnet SDKs
3 participants