I don't own the schema. Looking into migrating fro...
# apollo-kotlin
s
I don't own the schema. Looking into migrating from
@nonnull
fields. I know that I can apply e.g.
extend type MyNode @semanticNonNullField(name: "id")
next to where my fragment/query is located (+
@catch
on the field) (EDIT: can I really? 🤔) This however results in
Unknown directive '@catch'
error which gets resolved if I artificially apply it to my schema file:
Copy code
extend schema @link(
  url: "<https://specs.apollo.dev/nullability/v0.4>",
  import: ["@semanticNonNull", "@semanticNonNullField", "@catch", "CatchTo", "@catchByDefault"]
)
extend schema @catchByDefault(to: THROW)
Can I somehow extend the original schema with a separate file? Putting it within the aforementioned fragment does not work
✅ 1
Answering to myself - it seems that I can just create a separate
*.graphqls
file and put extensions over there
plus one 1
m
I was going to say exactly that, you beat me to it 🙂
s
Well thank you for confirming 🙇
m
I know this stuff is a bit hairy. The key thing to remember is: •
@semanticNonNull
describes your data => belongs to the schema •
@catch
describes your error handling => belongs to the query
The error handling belongs to the client. GraphQL did the mistake of conflating error handling with the type system a long time ago. We're slowly fixing that
s
Makes sense! Btw when I've first started I was reading GH docs and couldn't grasp this really - it was way easier to follow when I was checking out the migration docs.
m
Thanks for the feedback!
Indeed that's something that has changed a lot in 2025. The docs need a fresh coat of paint