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

Attributes on @relationship directive #154

Closed
noeljackson opened this issue Feb 4, 2021 · 6 comments
Closed

Attributes on @relationship directive #154

noeljackson opened this issue Feb 4, 2021 · 6 comments

Comments

@noeljackson
Copy link

Previously you were able to define relationship attributes like this:

  type Cause {
    id: ID! @id

    "Every Cause has at least one Effect"
    effects: [Effect]
  }

  type Effect @relation(
    from: "causedBy", 
    to: "causes"
  ) {
    "Every Effect is caused by a Cause"
    causedBy: Cause

    "Every Effect causes a Cause"
    causes: Cause

    description: String
  }

It doesn't seem possible to define a Type with an @relationship directive.

Will this feature come back in subsequent releases?

@danstarns
Copy link
Contributor

Hey @noeljackson Currently in the implementation, we do not support relationship poprerties. We have had a few requests to add it back & realize the pain for some. We are looking into solutions to get relationship properties to work with newer features such as nested mutations and auth. We had to make a trade-off in the first implementation to support highly requested features.

@noeljackson
Copy link
Author

@danstarns Thanks for the reply. In the current non-alpha version of neo4j-graphql-js they work great. Just to be clear: it wasn't part of the first implementation, but it's not off the table? My use case is something like this:

type User {
    name: String!
}
type Forum {
    name: String!
    permissions: [Permission]!
}
type Permission @relation(name: "MEMBER_OF", from: "user", to: "forum") {
    user: User
    forum: Forum
    role: Role!
}
enum Role {
    admin
    editor
    viewer
    none
}

The new auth features are really nice, but don't seem to support the type of granular permission you might want to implement in a scenario like the above.

I will take a look at the source and see where the difficulties for implementing it are at.

@danstarns
Copy link
Contributor

@noeljackson Thank you for sharing your usage. We are looking into relationship properties, as the library is still in Alpha, we have left some of these features open for; discussion, shaping, and improving.

@darrellwarde
Copy link
Contributor

Hi @noeljackson, just yesterday I created a pull request containing an RFC for the implementation of Relay, which will add support for relationship properties when implemented. I encourage you to take a look and give us some feedback on our current thoughts: https://github.com/neo4j/graphql-tracker-temp/pull/7

@darrellwarde
Copy link
Contributor

I'm going to close this for now given that this is definitely on our roadmap and the ball is rolling with an RFC.

@noeljackson
Copy link
Author

RFC is beautiful. I'm testing out the branch. Thank you @darrellwarde Stellar work.

@darrellwarde darrellwarde transferred this issue from another repository Apr 8, 2021
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

No branches or pull requests

3 participants