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

Add an error to go-runtime/compile when local Go identifier casing differs from FTL #1482

Open
alecthomas opened this issue May 14, 2024 · 2 comments
Labels
intermediate A task requiring an intermediate level of knowledge

Comments

@alecthomas
Copy link
Collaborator

Currently it's possible for a symbol to have two different casings within an FTL system - the native casing and the normalised FTL casing. We normalise casing across all languages to lowerCamelCase for fields and values, and UpperCamelCase for all types.

For example, if you have the following Go type:

type UserID struct {
  Name string
  ID string
}

This will be case-transformed to:

data UserId {
  name String
  id String
}

We should raise an error in this case.

@alecthomas alecthomas added the good first issue Good for newcomers label May 14, 2024
@github-actions github-actions bot added the triage Issue needs triaging label May 14, 2024
@deniseli deniseli removed the triage Issue needs triaging label May 15, 2024
@wesbillman
Copy link
Member

@alecthomas the team had some questions around this in standup and we wanted to make sure we understand the issue we're trying to solve here. Do you mind clarifying what behavior you want to error on?

I was guessing it was the case where you write time.go with a UserID and it would then have this different casing in the schema as UserId and perhaps even generate echo.go with UserId, which would then have different casing between 2 go modules.

Thanks!

@alecthomas
Copy link
Collaborator Author

That's exactly right. In the owning module time.go the casing would be UserID but in all consumers the casing would beUserId, which would be confusing.

@alecthomas alecthomas added intermediate A task requiring an intermediate level of knowledge and removed good first issue Good for newcomers labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intermediate A task requiring an intermediate level of knowledge
Projects
None yet
Development

No branches or pull requests

3 participants