SlideShare une entreprise Scribd logo
Is GraphQL really
self-documenting?
James Scott
Technical Writer at Moogsoft
@jwscott22
@jwscott22
“A common mistake people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools.”
- Douglas Adams
@jwscott22
1. What is the problem? 

2. What is GraphQL?

3. What is the answer?
Agenda
@jwscott22
@jwscott22
What does “self-documenting” mean?
Written and structured in such a way it can be
understood without documentation or prior-knowledge.
@jwscott22
Subjectivity with images
@jwscott22
@jwscott22
Subjectivity with words
query{
second
}
query{
number
}
query{
subject
}
1. Numerical value
2. A quantity or amount
3. To count (verb)
4. More numb
1. Topic
2. The noun in a sentence
3. Under some authority
1. Unit of time
2. Number 2 in a sequence
@jwscott22
“Self-documenting code is a unicorn”
@jwscott22
Others have said similar…
1. I made an object/function with a specific use
2. I gave it a name that explains that specific use
3. Doesn’t need docs because it’s obvious how it works.
@jwscott22
What it boils down to…
1. What is the problem? 

2. What is GraphQL?

3. What is the answer?
Agenda
@jwscott22
“…I think the biggest
mistake we made as a
company is betting too
much on HTML5 as
opposed to native…
because it just wasn’t
there… We burned two
years. That's really
painful.”
- Mark Zuckerberg, Facebook CEO
Origins of GraphQL
@jwscott22
Founders of GraphQL
Lee Byron
Nick Schrock
Dan Schafer
Mobile app dev team lead
Creator of SuperGraph
Facebook News Feed engineer
GraphQL at Facebook
@jwscott22
iOS News Feed
iOS Messenger
Ads Manager
Facebook Lite
iPad Pages
Android Feed
Relay
GraphQL
@jwscott22
Open-sourcing of GraphQL
@jwscott22
So what is GraphQL?
• Query language for APIs

• Can retrieve data using a query

• Can modify data using a mutation

• Client specifies exact data they want 

• Result is no over-fetching of data

• Exposes a single endpoint to do all of these things.
@jwscott22
Thinking in Graphs
@jwscott22
Graph theory!?
A Graph = A Tree
@jwscott22
Member
Book
“Frodo”
“Sam”
“Pippin”
“Merry”
“Aragorn”
“Boromir”
“Gimli”
“Legolas”
“Gandalf”
Hobbit
Man
Dwarf
Elf
Istari
Man
Hobbit
Hobbit
Hobbit
“The Fellowship of the Ring”
title
inFellowship
race
race
race
race
race
race
race
race
race
name name
name
name
name
name
What does GraphQL look like?
@jwscott22
{
hero {
name
}
}
{
"data" : {
"hero" : {
"name" : "Frodo"
}
}
}
Query to return related objects
@jwscott22
{
hero {
name
companion {
name
}
}
}
{
"data" : {
"hero" : {
"name" : "Frodo",
"companion" : [
{ "name" : "Sam" },
{ "name" : "Gandalf" },
{ "name" : "Legolas" },
{ "name" : "Gimli" },
{ "name" : "Aragorn" },
{ "name" : "Merry" },
{ "name" : "Pippin" }
]
}
}
}
Over-fetching
@jwscott22
$ curl https://localhost/lotr/v1/getInfo?characterid=6
[
{
"character":{
"name":"Aragorn",
"alias":"Strider",
"title":"King of the Reunited Kingdom",
"height":"1.98",
"house":"Telcontar",
"weapon":"Anduril",
"race":"Human",
"gender":"Male",
"age":"210",
"wife":"Arwen",
"father":"Arathorn",
"mother":"Gilraen",
}
}
]
Query using arguments
@jwscott22
{
character(id:"6") {
name
height
age
}
}
{
"data" : {
"character" : {
"name" : "Aragorn"
"height" : 1.98
"age" : 210
}
}
GraphQL mutations
@jwscott22
mutation {
addCategory(
id:1,
name: "hobbits",
characters: [1, 2, 7, 8]) {
name
characters {
name
}
}
}
{
"data" : {
"addCategory": {
"name": "hobbits",
"characters": [
{
"name": "Frodo"
},
{
"name": "Sam"
},
{
"name": "Merry"
},
{
"name": "Pippin"
}
]
}
}
}
GraphiQL (“Graphical”)
@jwscott22
Imagine landing here with no prior knowledge of:

• What the schema looks like
• How to structure a query
• What queries are even possible!
@jwscott22
@jwscott22
query {
user {
jwscott22 {
name
}
}
}
{
"data" : null,
"errors": [
{
"message": "Field 'user' is
missing required arguments: login",
"locations": [
{
"line": 2,
"column": 3}
]
},
{
"message": "Field 'jwscott22'
doesn't exist on type 'User'",
"locations": [
{
"line": 3,
"column": 5}
]
}
]
}
query {
user(login:jwscott22) {
name
avatarUrl
location
}
}
}
Scenario 1: Assumed Knowledge!
@jwscott22
@jwscott22
Scenario 2: ‘Self descriptive’?
1. What is the problem? 

2. What is GraphQL?

3. What is the answer?
Agenda
@jwscott22
<Insert_sensible_name>
“Naming is Super Important…”
@jwscott22
“Would a new engineer understand this?”
@jwscott22
“Naming things that adhere closely to what those things do is
really important to make this experience actually work”
What does the spec say?
@jwscott22
Hi Lee,
I’m writing a blog about GraphQL.
Could I ask you some questions
over video chat at some point?
James
Hi James!
Sorry for the delay. I’d be happy
to do an interview with you.
Lee
@jwscott22
@jwscott22
Advice from the co-creator
- Lee Byron, co-creator of GraphQL
“If there's no documentation, it doesn't matter how good the API is […]
If you do that wrong, people aren't going to be able to use it…”
@jwscott22
Filling the “clear space”
Constant FilmTYpe = new GraphQLObjectType({
name: 'Film',
description: 'A single film.',
fields: () => (
{
title: {
type: GraphQLString,
description: 'The title of this film.',
},
episodeID: {
type: GraphQLInt,
description: 'The episode number of this film.',
},
openingCrawl: {
type: GraphQLString,
description: ‘The opening paragraphs at the beginning of this film.',
},
director: {
type: GraphQLString,
description: ‘The name of the director of this film.',
},
@jwscott22
GraphiQL Docs Features
1. Inline descriptions 2. Autocomplete 3. Hover tool-tips
4. Introspection (⌥ + Space) 5. Introspection 6. Docs Explorer
Other GraphQL tools
@jwscott22
Not very human….
@jwscott22
“…an unhealthy reliance on the
self-documenting aspects of GraphQL …”
- Carolyn Stransky
What do other tech writers say?
@jwscott22
“… we thought that it was important to have educational stuff and
hand-holding material to introduce people to GraphQL…
…you don’t want to just assume that people know how to
formulate queries and mutations…”
- Andrew Johnston
“…documenting API endpoints explains how individual tools work,



explaining how to use those tools work together is a whole
other area of documentation effort…”
- Chris Ward
Documenting GraphQL
@jwscott22
1. Generic docs:
• On-boarding/hand-holding docs on basics.

2. API specific docs:
• Provide query and mutation examples.

• Supporting docs for specific use cases.

3. In the API itself:
• Choose appropriate names for your fields/types.

• Use good descriptions in the schema.
@jwscott22
The end?
“I didn’t think it would end this way.”
“End? No, the journey doesn’t end here.”
@jwscott22
Questions?
• “My Code is Self-documenting” - Eric Holcher http://ericholscher.com/blog/
2017/jan/27/code-is-self-documenting/

• “Why you should document your self-documenting code - Oleksandr
Kaleniuk - https://hackernoon.com/why-you-should-document-your-self-
documenting-code-1105a8a6852e

• Lessons from 4 Years of GraphQL (Lee Byron speaking at GraphQL Summit
2016) https://www.youtube.com/watch?v=zVNrqo9XGOs

• “Does GraphQL reduce the need for documentation?” - Chris Ward
@ChrisChinch https://blog.codeship.com/documenting-graphql/

• Documenting GraphQL at Shopify - Andrew Johnston @andrewjtech https://
www.youtube.com/watch?v=uuzsEfLaGnU&feature=youtu.be

• Life is Hard and so is learning GraphQL - Carolyn Stransky @carolstran
https://youtu.be/FsRSdGuj588
Resources & Further Reading
@jwscott22
• “self-documenting code” definition PC Magazine: https://
www.pcmag.com/encyclopedia/term/51077/self-documenting-code 

• The latest GraphQL spec: https://facebook.github.io/graphql/
June2018/

• Interview with GraphQL co-creator Lee Byron: https://nordicapis.com/
interview-with-graphql-co-creator-lee-byron/

• Repo of public GraphQL API docs and tools: https://github.com/
Jwscott22/GraphQL-docs

• An extensive list of public GraphQL APIs: https://github.com/APIs-
guru/graphql-apis

• Who’s Using GraphQL - https://graphql.org/users/
Other Resources
• Image:Pair-Program-Step-3-Version-2.jpg - © Creative Commons

• Hitchhikers Guide to the Galaxy - © Touchstone Pictures

• Gollum from the Two Towers (2002) - Warner Bros

• Art of Programming - © Geek and Poke

• Unicorn from Blade Runner (1982) - © Warner Bros

• Screenshot of Lessons from 4 Years of GraphQL - Apollo GraphQL

• Success Kid - Wikimedia Commons

• Pokemon Group - © Pokemon Company International Inc.

• Magnifying Glass - © KissPNG.com

• Robot Emoji- © emojiisland.com
Media Copyright

Contenu connexe

Similaire à Is GraphQL Really Self-documenting?

Connecting the Netflix Studio with GraphQL
Connecting the Netflix Studio with GraphQLConnecting the Netflix Studio with GraphQL
Connecting the Netflix Studio with GraphQLCarlos Solares
 
Kemal: Building Lightning Fast Web Applications With Crystal
Kemal: Building Lightning Fast Web Applications With CrystalKemal: Building Lightning Fast Web Applications With Crystal
Kemal: Building Lightning Fast Web Applications With CrystalSerdar Dogruyol
 
Demystifying NoSQL - All Things Open - October 2020
Demystifying NoSQL - All Things Open - October 2020Demystifying NoSQL - All Things Open - October 2020
Demystifying NoSQL - All Things Open - October 2020Matthew Groves
 
GraphQL vs Traditional Rest API
GraphQL vs Traditional Rest APIGraphQL vs Traditional Rest API
GraphQL vs Traditional Rest APIVladimir Dejanovic
 
JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4alexsaves
 
JSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataGregg Kellogg
 
NoSQL & MongoDB
NoSQL & MongoDBNoSQL & MongoDB
NoSQL & MongoDBShuai Liu
 
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...Elżbieta Bednarek
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaoladrewz lin
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018artgillespie
 
I don't know what I'm Doing: A newbie guide for Golang for DevOps
I don't know what I'm Doing: A newbie guide for Golang for DevOpsI don't know what I'm Doing: A newbie guide for Golang for DevOps
I don't know what I'm Doing: A newbie guide for Golang for DevOpsPeter Souter
 
コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門潤一 加藤
 
An Introduction To jQuery
An Introduction To jQueryAn Introduction To jQuery
An Introduction To jQueryAndy Gibson
 
Elasticsearch: You know, for search! and more!
Elasticsearch: You know, for search! and more!Elasticsearch: You know, for search! and more!
Elasticsearch: You know, for search! and more!Philips Kokoh Prasetyo
 
Long Live and Prosper To Monolith
Long Live and Prosper To MonolithLong Live and Prosper To Monolith
Long Live and Prosper To MonolithAlex Soto
 
Modeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based GamesModeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based GamesRay Toal
 

Similaire à Is GraphQL Really Self-documenting? (20)

Data exchange formats
Data exchange formatsData exchange formats
Data exchange formats
 
Connecting the Netflix Studio with GraphQL
Connecting the Netflix Studio with GraphQLConnecting the Netflix Studio with GraphQL
Connecting the Netflix Studio with GraphQL
 
Kemal: Building Lightning Fast Web Applications With Crystal
Kemal: Building Lightning Fast Web Applications With CrystalKemal: Building Lightning Fast Web Applications With Crystal
Kemal: Building Lightning Fast Web Applications With Crystal
 
Demystifying NoSQL - All Things Open - October 2020
Demystifying NoSQL - All Things Open - October 2020Demystifying NoSQL - All Things Open - October 2020
Demystifying NoSQL - All Things Open - October 2020
 
GraphQL vs Traditional Rest API
GraphQL vs Traditional Rest APIGraphQL vs Traditional Rest API
GraphQL vs Traditional Rest API
 
JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4JavaScript 2.0 in Dreamweaver CS4
JavaScript 2.0 in Dreamweaver CS4
 
All of javascript
All of javascriptAll of javascript
All of javascript
 
JSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked Data
 
Swift + GraphQL
Swift + GraphQLSwift + GraphQL
Swift + GraphQL
 
NoSQL & MongoDB
NoSQL & MongoDBNoSQL & MongoDB
NoSQL & MongoDB
 
GraphQL with Spring Boot
GraphQL with Spring BootGraphQL with Spring Boot
GraphQL with Spring Boot
 
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018
 
I don't know what I'm Doing: A newbie guide for Golang for DevOps
I don't know what I'm Doing: A newbie guide for Golang for DevOpsI don't know what I'm Doing: A newbie guide for Golang for DevOps
I don't know what I'm Doing: A newbie guide for Golang for DevOps
 
コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門
 
An Introduction To jQuery
An Introduction To jQueryAn Introduction To jQuery
An Introduction To jQuery
 
Elasticsearch: You know, for search! and more!
Elasticsearch: You know, for search! and more!Elasticsearch: You know, for search! and more!
Elasticsearch: You know, for search! and more!
 
Long Live and Prosper To Monolith
Long Live and Prosper To MonolithLong Live and Prosper To Monolith
Long Live and Prosper To Monolith
 
Modeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based GamesModeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based Games
 

Plus de Pronovix

By the time they're reading the docs, it's already too late
By the time they're reading the docs, it's already too lateBy the time they're reading the docs, it's already too late
By the time they're reading the docs, it's already too latePronovix
 
Optimizing Dev Portals with Analytics and Feedback
Optimizing Dev Portals with Analytics and FeedbackOptimizing Dev Portals with Analytics and Feedback
Optimizing Dev Portals with Analytics and FeedbackPronovix
 
Success metrics when launching your first developer portal
Success metrics when launching your first developer portalSuccess metrics when launching your first developer portal
Success metrics when launching your first developer portalPronovix
 
Documentation, APIs & AI
Documentation, APIs & AIDocumentation, APIs & AI
Documentation, APIs & AIPronovix
 
Making sense of analytics for documentation pages
Making sense of analytics for documentation pagesMaking sense of analytics for documentation pages
Making sense of analytics for documentation pagesPronovix
 
Feedback cycles and their role in improving overall developer experiences
Feedback cycles and their role in improving overall developer experiencesFeedback cycles and their role in improving overall developer experiences
Feedback cycles and their role in improving overall developer experiencesPronovix
 
GraphQL Isn't An Excuse To Stop Writing Docs
GraphQL Isn't An Excuse To Stop Writing DocsGraphQL Isn't An Excuse To Stop Writing Docs
GraphQL Isn't An Excuse To Stop Writing DocsPronovix
 
API Documentation For Web3
API Documentation For Web3API Documentation For Web3
API Documentation For Web3Pronovix
 
Why your API doesn’t solve my problem: A use case-driven API design
Why your API doesn’t solve my problem: A use case-driven API designWhy your API doesn’t solve my problem: A use case-driven API design
Why your API doesn’t solve my problem: A use case-driven API designPronovix
 
unREST among the docs
unREST among the docsunREST among the docs
unREST among the docsPronovix
 
Developing a best-in-class deprecation policy for your APIs
Developing a best-in-class deprecation policy for your APIsDeveloping a best-in-class deprecation policy for your APIs
Developing a best-in-class deprecation policy for your APIsPronovix
 
Annotate, Automate & Educate: Driving generated OpenAPI docs to benefit everyone
Annotate, Automate & Educate: Driving generated OpenAPI docs to benefit everyoneAnnotate, Automate & Educate: Driving generated OpenAPI docs to benefit everyone
Annotate, Automate & Educate: Driving generated OpenAPI docs to benefit everyonePronovix
 
What do developers do when it comes to understanding and using APIs?
What do developers do when it comes to understanding and using APIs?What do developers do when it comes to understanding and using APIs?
What do developers do when it comes to understanding and using APIs?Pronovix
 
Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations
Inclusive, Accessible Tech: Bias-Free Language in Code and ConfigurationsInclusive, Accessible Tech: Bias-Free Language in Code and Configurations
Inclusive, Accessible Tech: Bias-Free Language in Code and ConfigurationsPronovix
 
Creating API documentation for international communities
Creating API documentation for international communitiesCreating API documentation for international communities
Creating API documentation for international communitiesPronovix
 
One Developer Portal to Document Them All
One Developer Portal to Document Them AllOne Developer Portal to Document Them All
One Developer Portal to Document Them AllPronovix
 
Docs-as-Code: Evolving the API Documentation Experience
Docs-as-Code: Evolving the API Documentation ExperienceDocs-as-Code: Evolving the API Documentation Experience
Docs-as-Code: Evolving the API Documentation ExperiencePronovix
 
Developer journey - make it easy for devs to love your product
Developer journey - make it easy for devs to love your productDeveloper journey - make it easy for devs to love your product
Developer journey - make it easy for devs to love your productPronovix
 
Complexity is not complicatedness
Complexity is not complicatednessComplexity is not complicatedness
Complexity is not complicatednessPronovix
 
How cognitive biases and ranking can foster an ineffective architecture and d...
How cognitive biases and ranking can foster an ineffective architecture and d...How cognitive biases and ranking can foster an ineffective architecture and d...
How cognitive biases and ranking can foster an ineffective architecture and d...Pronovix
 

Plus de Pronovix (20)

By the time they're reading the docs, it's already too late
By the time they're reading the docs, it's already too lateBy the time they're reading the docs, it's already too late
By the time they're reading the docs, it's already too late
 
Optimizing Dev Portals with Analytics and Feedback
Optimizing Dev Portals with Analytics and FeedbackOptimizing Dev Portals with Analytics and Feedback
Optimizing Dev Portals with Analytics and Feedback
 
Success metrics when launching your first developer portal
Success metrics when launching your first developer portalSuccess metrics when launching your first developer portal
Success metrics when launching your first developer portal
 
Documentation, APIs & AI
Documentation, APIs & AIDocumentation, APIs & AI
Documentation, APIs & AI
 
Making sense of analytics for documentation pages
Making sense of analytics for documentation pagesMaking sense of analytics for documentation pages
Making sense of analytics for documentation pages
 
Feedback cycles and their role in improving overall developer experiences
Feedback cycles and their role in improving overall developer experiencesFeedback cycles and their role in improving overall developer experiences
Feedback cycles and their role in improving overall developer experiences
 
GraphQL Isn't An Excuse To Stop Writing Docs
GraphQL Isn't An Excuse To Stop Writing DocsGraphQL Isn't An Excuse To Stop Writing Docs
GraphQL Isn't An Excuse To Stop Writing Docs
 
API Documentation For Web3
API Documentation For Web3API Documentation For Web3
API Documentation For Web3
 
Why your API doesn’t solve my problem: A use case-driven API design
Why your API doesn’t solve my problem: A use case-driven API designWhy your API doesn’t solve my problem: A use case-driven API design
Why your API doesn’t solve my problem: A use case-driven API design
 
unREST among the docs
unREST among the docsunREST among the docs
unREST among the docs
 
Developing a best-in-class deprecation policy for your APIs
Developing a best-in-class deprecation policy for your APIsDeveloping a best-in-class deprecation policy for your APIs
Developing a best-in-class deprecation policy for your APIs
 
Annotate, Automate & Educate: Driving generated OpenAPI docs to benefit everyone
Annotate, Automate & Educate: Driving generated OpenAPI docs to benefit everyoneAnnotate, Automate & Educate: Driving generated OpenAPI docs to benefit everyone
Annotate, Automate & Educate: Driving generated OpenAPI docs to benefit everyone
 
What do developers do when it comes to understanding and using APIs?
What do developers do when it comes to understanding and using APIs?What do developers do when it comes to understanding and using APIs?
What do developers do when it comes to understanding and using APIs?
 
Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations
Inclusive, Accessible Tech: Bias-Free Language in Code and ConfigurationsInclusive, Accessible Tech: Bias-Free Language in Code and Configurations
Inclusive, Accessible Tech: Bias-Free Language in Code and Configurations
 
Creating API documentation for international communities
Creating API documentation for international communitiesCreating API documentation for international communities
Creating API documentation for international communities
 
One Developer Portal to Document Them All
One Developer Portal to Document Them AllOne Developer Portal to Document Them All
One Developer Portal to Document Them All
 
Docs-as-Code: Evolving the API Documentation Experience
Docs-as-Code: Evolving the API Documentation ExperienceDocs-as-Code: Evolving the API Documentation Experience
Docs-as-Code: Evolving the API Documentation Experience
 
Developer journey - make it easy for devs to love your product
Developer journey - make it easy for devs to love your productDeveloper journey - make it easy for devs to love your product
Developer journey - make it easy for devs to love your product
 
Complexity is not complicatedness
Complexity is not complicatednessComplexity is not complicatedness
Complexity is not complicatedness
 
How cognitive biases and ranking can foster an ineffective architecture and d...
How cognitive biases and ranking can foster an ineffective architecture and d...How cognitive biases and ranking can foster an ineffective architecture and d...
How cognitive biases and ranking can foster an ineffective architecture and d...
 

Dernier

Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupCatarinaPereira64715
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2DianaGray10
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Thierry Lestable
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...Sri Ambati
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesThousandEyes
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsVlad Stirbu
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...Elena Simperl
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
 

Dernier (20)

Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 

Is GraphQL Really Self-documenting?

  • 1. Is GraphQL really self-documenting? James Scott Technical Writer at Moogsoft @jwscott22
  • 3. “A common mistake people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.” - Douglas Adams @jwscott22
  • 4. 1. What is the problem? 
 2. What is GraphQL?
 3. What is the answer? Agenda @jwscott22
  • 6. What does “self-documenting” mean? Written and structured in such a way it can be understood without documentation or prior-knowledge. @jwscott22
  • 8. @jwscott22 Subjectivity with words query{ second } query{ number } query{ subject } 1. Numerical value 2. A quantity or amount 3. To count (verb) 4. More numb 1. Topic 2. The noun in a sentence 3. Under some authority 1. Unit of time 2. Number 2 in a sequence
  • 11. 1. I made an object/function with a specific use 2. I gave it a name that explains that specific use 3. Doesn’t need docs because it’s obvious how it works. @jwscott22 What it boils down to…
  • 12. 1. What is the problem? 
 2. What is GraphQL?
 3. What is the answer? Agenda @jwscott22
  • 13. “…I think the biggest mistake we made as a company is betting too much on HTML5 as opposed to native… because it just wasn’t there… We burned two years. That's really painful.” - Mark Zuckerberg, Facebook CEO Origins of GraphQL @jwscott22
  • 14. Founders of GraphQL Lee Byron Nick Schrock Dan Schafer Mobile app dev team lead Creator of SuperGraph Facebook News Feed engineer
  • 15. GraphQL at Facebook @jwscott22 iOS News Feed iOS Messenger Ads Manager Facebook Lite iPad Pages Android Feed
  • 18. So what is GraphQL? • Query language for APIs • Can retrieve data using a query • Can modify data using a mutation • Client specifies exact data they want • Result is no over-fetching of data • Exposes a single endpoint to do all of these things. @jwscott22
  • 20. A Graph = A Tree @jwscott22 Member Book “Frodo” “Sam” “Pippin” “Merry” “Aragorn” “Boromir” “Gimli” “Legolas” “Gandalf” Hobbit Man Dwarf Elf Istari Man Hobbit Hobbit Hobbit “The Fellowship of the Ring” title inFellowship race race race race race race race race race name name name name name name
  • 21. What does GraphQL look like? @jwscott22 { hero { name } } { "data" : { "hero" : { "name" : "Frodo" } } }
  • 22. Query to return related objects @jwscott22 { hero { name companion { name } } } { "data" : { "hero" : { "name" : "Frodo", "companion" : [ { "name" : "Sam" }, { "name" : "Gandalf" }, { "name" : "Legolas" }, { "name" : "Gimli" }, { "name" : "Aragorn" }, { "name" : "Merry" }, { "name" : "Pippin" } ] } } }
  • 23. Over-fetching @jwscott22 $ curl https://localhost/lotr/v1/getInfo?characterid=6 [ { "character":{ "name":"Aragorn", "alias":"Strider", "title":"King of the Reunited Kingdom", "height":"1.98", "house":"Telcontar", "weapon":"Anduril", "race":"Human", "gender":"Male", "age":"210", "wife":"Arwen", "father":"Arathorn", "mother":"Gilraen", } } ]
  • 24. Query using arguments @jwscott22 { character(id:"6") { name height age } } { "data" : { "character" : { "name" : "Aragorn" "height" : 1.98 "age" : 210 } }
  • 25. GraphQL mutations @jwscott22 mutation { addCategory( id:1, name: "hobbits", characters: [1, 2, 7, 8]) { name characters { name } } } { "data" : { "addCategory": { "name": "hobbits", "characters": [ { "name": "Frodo" }, { "name": "Sam" }, { "name": "Merry" }, { "name": "Pippin" } ] } } }
  • 26. GraphiQL (“Graphical”) @jwscott22 Imagine landing here with no prior knowledge of: • What the schema looks like • How to structure a query • What queries are even possible!
  • 28. @jwscott22 query { user { jwscott22 { name } } } { "data" : null, "errors": [ { "message": "Field 'user' is missing required arguments: login", "locations": [ { "line": 2, "column": 3} ] }, { "message": "Field 'jwscott22' doesn't exist on type 'User'", "locations": [ { "line": 3, "column": 5} ] } ] } query { user(login:jwscott22) { name avatarUrl location } } }
  • 29. Scenario 1: Assumed Knowledge! @jwscott22
  • 31. 1. What is the problem? 
 2. What is GraphQL?
 3. What is the answer? Agenda @jwscott22
  • 32. <Insert_sensible_name> “Naming is Super Important…” @jwscott22 “Would a new engineer understand this?”
  • 33. @jwscott22 “Naming things that adhere closely to what those things do is really important to make this experience actually work”
  • 34. What does the spec say? @jwscott22
  • 35. Hi Lee, I’m writing a blog about GraphQL. Could I ask you some questions over video chat at some point? James Hi James! Sorry for the delay. I’d be happy to do an interview with you. Lee @jwscott22
  • 37. - Lee Byron, co-creator of GraphQL “If there's no documentation, it doesn't matter how good the API is […] If you do that wrong, people aren't going to be able to use it…” @jwscott22
  • 38. Filling the “clear space” Constant FilmTYpe = new GraphQLObjectType({ name: 'Film', description: 'A single film.', fields: () => ( { title: { type: GraphQLString, description: 'The title of this film.', }, episodeID: { type: GraphQLInt, description: 'The episode number of this film.', }, openingCrawl: { type: GraphQLString, description: ‘The opening paragraphs at the beginning of this film.', }, director: { type: GraphQLString, description: ‘The name of the director of this film.', }, @jwscott22
  • 39. GraphiQL Docs Features 1. Inline descriptions 2. Autocomplete 3. Hover tool-tips 4. Introspection (⌥ + Space) 5. Introspection 6. Docs Explorer
  • 41. Not very human…. @jwscott22 “…an unhealthy reliance on the self-documenting aspects of GraphQL …” - Carolyn Stransky
  • 42. What do other tech writers say? @jwscott22 “… we thought that it was important to have educational stuff and hand-holding material to introduce people to GraphQL… …you don’t want to just assume that people know how to formulate queries and mutations…” - Andrew Johnston “…documenting API endpoints explains how individual tools work,
 
 explaining how to use those tools work together is a whole other area of documentation effort…” - Chris Ward
  • 43. Documenting GraphQL @jwscott22 1. Generic docs: • On-boarding/hand-holding docs on basics. 2. API specific docs: • Provide query and mutation examples. • Supporting docs for specific use cases. 3. In the API itself: • Choose appropriate names for your fields/types. • Use good descriptions in the schema.
  • 44. @jwscott22 The end? “I didn’t think it would end this way.” “End? No, the journey doesn’t end here.”
  • 46. • “My Code is Self-documenting” - Eric Holcher http://ericholscher.com/blog/ 2017/jan/27/code-is-self-documenting/ • “Why you should document your self-documenting code - Oleksandr Kaleniuk - https://hackernoon.com/why-you-should-document-your-self- documenting-code-1105a8a6852e • Lessons from 4 Years of GraphQL (Lee Byron speaking at GraphQL Summit 2016) https://www.youtube.com/watch?v=zVNrqo9XGOs • “Does GraphQL reduce the need for documentation?” - Chris Ward @ChrisChinch https://blog.codeship.com/documenting-graphql/ • Documenting GraphQL at Shopify - Andrew Johnston @andrewjtech https:// www.youtube.com/watch?v=uuzsEfLaGnU&feature=youtu.be • Life is Hard and so is learning GraphQL - Carolyn Stransky @carolstran https://youtu.be/FsRSdGuj588 Resources & Further Reading @jwscott22
  • 47. • “self-documenting code” definition PC Magazine: https:// www.pcmag.com/encyclopedia/term/51077/self-documenting-code • The latest GraphQL spec: https://facebook.github.io/graphql/ June2018/ • Interview with GraphQL co-creator Lee Byron: https://nordicapis.com/ interview-with-graphql-co-creator-lee-byron/ • Repo of public GraphQL API docs and tools: https://github.com/ Jwscott22/GraphQL-docs • An extensive list of public GraphQL APIs: https://github.com/APIs- guru/graphql-apis • Who’s Using GraphQL - https://graphql.org/users/ Other Resources
  • 48. • Image:Pair-Program-Step-3-Version-2.jpg - © Creative Commons • Hitchhikers Guide to the Galaxy - © Touchstone Pictures • Gollum from the Two Towers (2002) - Warner Bros • Art of Programming - © Geek and Poke • Unicorn from Blade Runner (1982) - © Warner Bros • Screenshot of Lessons from 4 Years of GraphQL - Apollo GraphQL • Success Kid - Wikimedia Commons • Pokemon Group - © Pokemon Company International Inc. • Magnifying Glass - © KissPNG.com • Robot Emoji- © emojiisland.com Media Copyright