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

Disallow Get on fields that are a part of a oneof #9

Open
achew22 opened this issue Apr 19, 2024 · 1 comment
Open

Disallow Get on fields that are a part of a oneof #9

achew22 opened this issue Apr 19, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@achew22
Copy link

achew22 commented Apr 19, 2024

Is it possible to instruct the linter to error on cases where you're getting one of the fields inside of a oneof?

For example:

message Foo {
  oneof bar {
    string baz = 1;
    string quix = 2;
  }
}

I would like to make it a lint error to call GetBaz and GetQuix directly in favor of always doing a type switch on the output of GetBar(). I don't see a documented way to do that but was curious if such a thing was possible.

Thanks so much!

@ghostiam
Copy link
Owner

Thank you for your interest in the project.

I think we can make an optional setting for this case.
I'll see what I can do as soon as I can.

Thanks for the idea!

@ghostiam ghostiam added the enhancement New feature or request label Apr 19, 2024
@ghostiam ghostiam self-assigned this Apr 19, 2024
@ghostiam ghostiam removed their assignment May 7, 2024
@ghostiam ghostiam added the help wanted Extra attention is needed label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants