Allow empty object types - #1228
Conversation
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
8c40697 to
21a2a8c
Compare
8c13477 to
220e8d4
Compare
Notes from meeting:We should support syntax grammar for key motivation is that "a schema minus all deprecated elements is always valid" which today could be not true! For a bunch of reasons but in this case: this cannot create a valid non-deprecated schema! that's our aim. Another example: a mutation payload (relay style) that wants to be defined up front as Specifically important because the LLM-focused subschema generation still has some issues we're working out, and it's unclear that providing |
|
Looks like we'll need the same for input objects? |
|
I am not sure this is the right place to comment, but together with the issue about interfaces without fields and interfaces without objects implementing them I am wondering if we should distinguish between valid schemas vs valid and executable schemas. For example an interface without an implementation is not something I find sensible for a real schema that should be executed but for schema during design it is ok. |
@andimarek My preference here would be a lint warning. The spec is already a bit vague on SDL validation (see #1233 (comment)) so we're not really equipped to have executable vs non-executable validation yet. |
Merge first:
Since 2015 we've always required an object type to define at least 1 field. As we continue to explore GraphQL's position in the new AI-world, we realise that we need schema subsets that represents part of a larger interface, in these cases it's sometimes useful to leave in type references without including full definitions of those types:
Here the AI can see a basic schema it can write queries against, but it can also ask to expand the parts of the schema that are relevant to its interests - e.g. books or articles or publishers - without wasting context on things it doesn't care about.
We can make a schema like this valid by including at least one field on each of these types, but it's hard for a tool to know which field(s) to include, and not including fields makes it much more obvious to the LLM that the schema is partial. Making this partial schema itself valid would be helpful for tooling.
AI aside:
type MyMutationPayload { success: Boolean! }is used as a workaround, but it's messy.Related: