escape from the tower of babel - mike boufford, greenhouse
TRANSCRIPT
![Page 1: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/1.jpg)
G R E E N H O U S E . IO
Escape from the Tower of Babelor Using JSON-Schema to Enforce API Contracts
@mboufford - Mike Boufford, VP of Engineering at Greenhouse
![Page 2: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/2.jpg)
What we’ll talk about
Primarily• Foxclores• Luzodins• Maozblitzers
But, also!• Norristronomy*• Fuffapesterinos• and of course, Hawkoons
![Page 3: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/3.jpg)
I’ll presume that you’re all familiar with those terms?
![Page 4: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/4.jpg)
Our APIs are all speaking a Glossopoeia!
![Page 5: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/5.jpg)
A brief history of Schemata
• Schema comes from the Greek skhēma which translates to “form”
• The great German philosopher Kant took the term to mean “a conception of what is common to all members of a class"
![Page 6: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/6.jpg)
1996: The Internet’s Rumspringa
![Page 7: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/7.jpg)
D o u g l a s C r o c k f o r dDiscoverer of JSON and opinionated linter
{ something: “Blargh!” }
“Hey! Look what I found! We can
use this to send data on the
Internets!”
![Page 8: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/8.jpg)
:-(
Um…Now I have to write adapters for everything I receive from anyone else, forever and ever.On the upside: #jobsecurity!
![Page 9: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/9.jpg)
We now live in a world that is hostile to schemata
![Page 10: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/10.jpg)
Stop the insanity!Itigil ni ito pagkabaliw Hayaan.
এর এই পাগলািম বn করা যাক .
Давайце спынім гэта вар'яцтва .
让我们停⽌止这种疯狂。
. בואו נעצור הטירוף הזה
ဒ" #$%သ'ပ)*ခင)% ကiuရပ)တ2)3 4ကကuန)အ73။Pojďme se zastavit toto šílenství .
. اس پاگلپن کو روکنے کے ہیں
![Page 11: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/11.jpg)
First Step:
Teach people JSON-Schema
1JSON-Schema is a composable JSON-based schema language. It looks like this:
{
‘$schema’: ‘http://foo.com/person-01/schema’,
‘type’: ‘object’,
‘properties’: {
‘first_name’: { ‘type’: ‘string’ },
‘last_name’: { ‘type’: ‘string’ }
},
‘required’: [ ‘first_name’, ‘last_name’ ]
}
![Page 12: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/12.jpg)
Composability {
‘$schema’: ‘http://foo.com/user-01/schema’,
‘type’: ‘object’,
‘properties’: {
‘user_id’: { ‘type’: ‘number’ },
‘person’: {
‘$ref’: ‘http://foo.com/person-01/schema’
}
},
‘required’: [ ‘user_id’, ‘person’ ]
}
Keeping things DRY
![Page 13: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/13.jpg)
Simple{ ‘http_status_code’: { ‘type’: ‘string’ } }
![Page 14: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/14.jpg)
Validation{ ‘http_status_code’: {
‘type’: ‘string’,
‘pattern’: ‘^[0-9]{3}$’
} }
![Page 15: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/15.jpg)
Validation { ‘http_status_code’: {
‘type’: ‘number’,
‘enum’: [ 200, 403, 500 ]
} }
Part Deux
{ ‘http_status_code’: 500 }
![Page 16: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/16.jpg)
Automated API Tests
![Page 17: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/17.jpg)
JSON Hyper-Schema!
Enforcing RESTfulnessAnd we ain’t talking about nap time.
![Page 18: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/18.jpg)
e.g., {
"href": “/apples“,
"method": "POST",
"rel": "self",
"targetSchema": {
"$ref": “http://foo.com/apple-schema#",
}
}
HYPER! AHHH!
![Page 19: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/19.jpg)
So Dang EZ! What’s the catch?
![Page 20: Escape from the Tower of Babel - Mike Boufford, Greenhouse](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58ee10bd1a28ab47558b463f/html5/thumbnails/20.jpg)
Thank you.