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

Support a way to hide fields from interfaces #1829

Closed
paulpdaniels opened this issue Aug 10, 2023 · 1 comment · Fixed by #1975
Closed

Support a way to hide fields from interfaces #1829

paulpdaniels opened this issue Aug 10, 2023 · 1 comment · Fixed by #1975
Assignees
Labels
enhancement New feature or request server Issue related to caliban server

Comments

@paulpdaniels
Copy link
Collaborator

At the moment if you declare a field in a type and then compose it under an interface the interface will automatically expose all of the fields that appear in all implementations of the interface. There are however cases where this is not desirable behavior. Consider for instance a federated graph where different subgraphs expose different implementations of the interface:

// Search graph
interface Product {
  id: ID!
}

type Query {
  search(): [Product!]!
}


// Store graph
type PhysicalProduct implements Product {
   id: ID!
   location: String!
   shippingCost: Int!
}

// Web graph
type WebProduct {
  id: ID!
  url: String!
}

Since each subgraph would not know about the implementations within the other graphs it would have no way of knowing which fields can be safely exposed.

I know magnolia doesn't support resolution of the fields within a scala interface, but we can probably go the other way and exclude them from an interface (perhaps even a specific interface?) by using an annotation like GQLExcludeInterface to mark a field as not visible to the interface.

@paulpdaniels paulpdaniels added enhancement New feature or request server Issue related to caliban server core labels Aug 10, 2023
@kyri-petrou
Copy link
Collaborator

I can give this a go. I think it should be fairly straightforward with annotations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server Issue related to caliban server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants