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

fix: ensure topic name matches idiomatic variable name #1958

Merged
merged 9 commits into from
Jul 23, 2024

Conversation

safeer
Copy link
Contributor

@safeer safeer commented Jul 3, 2024

Fixes #1919

@safeer safeer requested review from alecthomas and a team as code owners July 3, 2024 21:11
@safeer safeer requested review from matt2e and removed request for a team July 3, 2024 21:11
@ftl-robot ftl-robot mentioned this pull request Jul 3, 2024
@safeer
Copy link
Contributor Author

safeer commented Jul 3, 2024

WIP: just need to go from test_topic to TestTopic

@alecthomas alecthomas requested a review from worstell July 4, 2024 09:55
if t, ok := varDecl.Specs[0].(*ast.ValueSpec); ok {
varName := t.Names[0].Name
if expVarName := strcase.ToUpperCamel(name); varName != expVarName {
pctx.errors.add(errorf(node, "unexpected topic variable name %q, did you mean %q?", varName, expVarName))
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice

@wesbillman
Copy link
Member

@safeer is this one ready to merge or do you have more changes coming?

@safeer
Copy link
Contributor Author

safeer commented Jul 12, 2024

@safeer is this one ready to merge or do you have more changes coming?

@wesbillman this is a breaking change that requires clients to update their topic varnames

@safeer
Copy link
Contributor Author

safeer commented Jul 12, 2024

Introduced a stripped upper camel case to remove the grossness in the generated code that was being forced upon the original source. See my convo with myself in #1919 😆

Still breaks client code; varname for a topic like "public_broadcast" must now be var PublicBroadcast

@safeer safeer marked this pull request as draft July 12, 2024 22:59
@safeer safeer marked this pull request as ready for review July 18, 2024 21:12
@safeer
Copy link
Contributor Author

safeer commented Jul 18, 2024

Now prescriptive about topic names. Breaks client code, so not merging yet.

@safeer safeer merged commit c3c7aa6 into main Jul 23, 2024
59 checks passed
@safeer safeer deleted the saf/topic-var-name-match branch July 23, 2024 21:50
github-merge-queue bot pushed a commit that referenced this pull request Aug 13, 2024
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.

Reconsider topic names as variable names
4 participants