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

Duplicate enum element #1629

Closed
sealter opened this issue Jan 8, 2024 · 5 comments
Closed

Duplicate enum element #1629

sealter opened this issue Jan 8, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@sealter
Copy link

sealter commented Jan 8, 2024

I have a rust enum type:

enum NamedType { NewYork, London, Other, }

the generate code has two NamedType::other.

I removed Other element, and regenerate, but the two NamedTYpe::other still exists.

Copy link

welcome bot commented Jan 8, 2024

Hi! Thanks for opening your first issue here! 😄

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jan 8, 2024

Hi, could you please provide a minimal reproducible sample? (steps are in https://github.com/fzyzcjy/flutter_rust_bridge/issues/new?assignees=&labels=bug&projects=&template=bug_report.yaml template). Otherwise it does not seem to be easy to reproduce, since it works well in test cases.

@fzyzcjy fzyzcjy added the awaiting Waiting for responses, PR, further discussions, upstream release, etc label Jan 8, 2024
@sealter
Copy link
Author

sealter commented Jan 8, 2024

Sorry, It's the problem of graphql-client , It will generate Other(String) element for Enum type.

fragments_other_variant option is always on.
code: Other(string)

I have defined other in my Enum, so There are two other in the frb_generated.io.rs like:

7 => crate::api::NamedType::other,
8 => {
    let ans = unsafe { self.kind.Other };
    crate::api::NamedType::Other(ans.field0.cst_decode())
}

The same, there are two other field in the generated dart like:

const factory NamedType.other() = NamedType_other;
const factory NamedType.other(
  String field0,
) = NamedType_Other;

in the freezed dart file there are too many other, so the project cann't run.

Thank you, I will close this issue.

@sealter sealter closed this as completed Jan 8, 2024
@fzyzcjy
Copy link
Owner

fzyzcjy commented Jan 8, 2024

You are welcome, and happy to see it solved!

@fzyzcjy fzyzcjy added bug Something isn't working and removed awaiting Waiting for responses, PR, further discussions, upstream release, etc labels Jan 11, 2024
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants