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

Multiple double edges produce conflicting implementations of trait #53

Closed
vkatushenok opened this issue May 1, 2022 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@vkatushenok
Copy link
Contributor

vkatushenok commented May 1, 2022

Summary

Multiple double edges produce conflicting implementations of trait.

Example schema

model ModelA {
  id String @id

  edgeOne   ModelB @relation("one", fields: [edgeOneId], references: [id])
  edgeOneId String
  edgeTwo   ModelB @relation("two", fields: [edgeTwoId], references: [id])
  edgeTwoId String
}

model ModelB {
  id String @id

  asEdgeOne ModelA[] @relation("one")
  asEdgeTwo ModelA[] @relation("two")
}

Generated code

impl From<super::model_b::Args> for WithParam {
    fn from(args: super::model_b::Args) -> Self {
        Self::EdgeOne(args)
    }
}
impl From<super::model_b::Args> for WithParam {
    fn from(args: super::model_b::Args) -> Self {
        Self::EdgeTwo(args)
    }
}

// ...

impl From<super::model_a::FindManyArgs> for WithParam {
    fn from(args: super::model_a::FindManyArgs) -> Self {
        Self::AsEdgeOne(args)
    }
}
impl From<super::model_a::FindManyArgs> for WithParam {
    fn from(args: super::model_a::FindManyArgs) -> Self {
        Self::AsEdgeTwo(args)
    }
}
@Brendonovich Brendonovich added bug Something isn't working codegen labels May 1, 2022
@Brendonovich
Copy link
Owner

Didn't consider this but I know why it's occurring. Will fix in the next release

@Brendonovich
Copy link
Owner

I think I've got it, try using rev = "9af8c576a53cfeefc65118cf5ab8fe310a92c2a3" instead of tag = "0.4.1"

@vkatushenok
Copy link
Contributor Author

Tested on a complex schema along with SQLite and it works as expected, thanks for looking into this! 🙇🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants