-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Strawman: add sameAs property to __Type to announce mapping/equality to other schemas/types #1022
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Hi @saerdnaer; maybe you want to bring this to a WG meeting for discussion? https://github.com/graphql/graphql-wg/tree/main/agendas/2023 |
@benjie Sure, I will try to attend on Sept. 7 – but might be in a train with possibly bad internet connection... we will see. graphql/graphql-wg#1374 |
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
I know you proposed this for object types, but I feel this could be broadened to increase value. E.g. rather than being "same as" perhaps it could be "conforms to"? This would be particularly valuable for custom scalars, e.g. scalar Name
# Treat Name as a String
@conformsTo(url: "https://spec.graphql.org/September2025/#sec-String")
# Note it's also a schema.org Name
@conformsTo(url: "https://schema.org/name")
# Note it's ALSO a GraphQL Name (i.e. constrained string)
@conformsTo(url: "https://spec.graphql.org/September2025/#Name") One potential issue with this framing is the input/output tension; e.g. on output it's fine to just treat it as an arbitrary For object types, if it conforms to something I think that means it implements at least the specified fields, but that it may additionally implement additional fields. I also think that this is probably better suited to a GraphQL interface - the object implements the interface, and the interface conforms to the requirements of the external URL. Though in your case, you literally want identity with an external type, so perhaps it's not quite right... 🤔 |
In the linked example I only wanted to specify that type Item @conformsTo(uri: "https://schema.org/PodcastEpisode", mapping: EXACT) {
id: ID!
…
} Maybe we should define one build-in directive + introspection property which works of all kind of GraphQL Base Entities, and maybe add a second optional parameter which clarifies how deep the relationship goes / both match with each other. For example, during working on LinkML schema, I came across following definitions:
scalar Name
# Treat Name as a String
@conformsTo(url: "https://spec.graphql.org/September2025/#sec-String")
# Note it's also a schema.org Name
@conformsTo(url: "https://schema.org/name", mapping: EXACT) [For other readers: You might also have a look at the parallel, more SDL driven, discussion in w3c/graphql-rdf/issues/4 ] |
@benjie Should I try to join the GraphQL WG meeting on Thursday 19:30 CET to discuss this further? |
related to w3c/graphql-rdf#4