Apidays Paris 2023 - Software and APIs for Smart, Sustainable and Sovereign Societies
December 6, 7 & 8, 2023
GraphQL Nullability, State of the Union
Martin Bonnin, Mobile Engineer at Apollo GraphQL
------
Check out our conferences at https://www.apidays.global/
Do you want to sponsor or talk at one of our conferences?
https://apidays.typeform.com/to/ILJeAaV8
Learn more on APIscene, the global media made by the community for the community:
https://www.apiscene.io
Explore the API ecosystem with the API Landscape:
https://apilandscape.apiscene.io/
25. @Composable
fun VideoItem(response: Response) {
if (response.errors.any { it.path == "video.title" }) {
Error() // Can't display a video without a title
} else {
if (response.data.video.title != null) {
Text(text = "This video does not have a title yet")
} else {
Text(text = response.data.video.title!!)
}
if (response.errors.any { it.path == "video.viewCount" }) {
// Skip viewCount
} else {
Text(text = "${response.data.video.viewCount!!} + views")
}
}
}
Partial data
30. Documentation
type Video {
"""
The title of the Video
null if the video has just been uploaded
"""
title: String
"""
Number of times this video has been watched
Never null unless there is an error
"""
viewCount: Int
}
32. Nullability working group
2021
Client Controlled
Nullability
May 2023
sub working group
Sep 2023
GraphQL conf
True nullability
Asterisk
Interrobang
Oct 2023
semantic-non-null
@strictNullability
@catch
graphql/nullability-wg
33. Nullability working group
2021
Client Controlled
Nullability
May 2023
sub working group
Sep 2023
GraphQL conf
True nullability
Asterisk
Interrobang
Oct 2023
semantic-non-null
@strictNullability
@catch
graphql/nullability-wg
34. Asterisk
string → String!
string | null → don’t use
string | error → String*
string | null | error → String
graphql/graphql-spec/pull/1048
Never a semantic
null
44. Problem 2: what default?
● Fail the whole query
○ Easy
○ Fragile
● Handle field errors
○ Hard
○ Robust
45. Opting in error handling
● Start easy
● Add error handling progressively
fragment VideoDetails on Video {
video {
title
# opt-in error handling
viewCount @catch
}
}
facebook/relay/issues/4416
46. Opting in error handling
fragment VideoDetails on Video {
video {
title
# opt-in error handling
viewCount @catch
}
}
sealed interface Result<T> {
class Success(val value: T): Result
class Failure(val error: error): Result
}
Video(
val title: String
val viewCount: Result<Int>
)
apollographql/apollo-kotlin/pull/5405
51. Layouts
How do I add a new slide with a preexisting layout?
Layout Guidelines
To add template to a blankslide, click on layout. Click on any template and start editing.
52. Font & Sizes
How do I edit text while keeping the same font style and size?
Layout Guidelines
Right click “Paste without formatting” Or select your text and click “Clear formatting”
53. Add images
How do I add a image container?
Layout Guidelines
Click on the picture icon
to replace image
Double Click to resize or
adjust image placement
Test it out here!
66. Exploring what we learned from hundreds of organizations transforming
their business and customer experiences with GraphQL
Insights on the rise of GraphQL
John Doe
Engineer
Katharina Wagner
October 2023 Sunday palace
Engineer
67. Exploring what we learned from hundreds of organizations transforming
their business and customer experiences with GraphQL
Insights on the rise of GraphQL
John Doe
Engineer
Katharina Wagner
Engineer
October 2023 on Sunday Palace
76. “If a monolithic architecture is working
for your company, then don't let us be
the ones to convince you otherwise. If
you are down this microservices road,
then Federation is a really great option.”
Meeng Chee
CEO at Peloton
Email or contact
77. APIs fuel growth.
They are a critical component of every digital initiative in the modern age.
Modernization
initiatives
Developer velocity Omni-channel Mergers and
acquisitions
78. How do the developers that support these initiatives
access all of these APIs?
Products
Images
Deals
Reviews
Inventory
Recommend
ations
80. ● Self-service
Teams can use them
asynchronously.
● Paved road
A clear, proven path
for teams to follow.
● Time to value
New users get great
results quickly.
● Coherence
Teams can easily find
what they need.
● Cohesion
Features build on each
other.
● Opinionated
A platform cannot be
one-size-fits all.
81. A really long long
subtitle with at least 3
lines of text.
Item title
Build variants of your graph for testing,
staging, and production environments.
Prevent breaking changes
Ensure you can safely deliver changes
across all clients using schema checks.
Communicate cross-functionally
Deliver notifications to systems and
teams using webhooks.
Title
82. Safely ship changes to
the graph with tools
that integrate with your
CI/CD pipeline.
Test with ease
Build variants of your graph for testing,
staging, and production environments.
Prevent breaking changes
Ensure you can safely deliver changes
across all clients using schema checks.
Communicate cross-functionally
Deliver notifications to systems and
teams using webhooks.
DELIVER