2. ABOUT ME: THOMAS BAYER
25 years of experience in distributed computing
REST since 2002
Cofounder of predic8 & Orientation in Objects (Germany)
Open Source Developer ( Membrane Service Proxy )
Father of three
Yogi
@thomasub
26. Adding a new field âweightâ
{
"id": 8,
"name": "Apple"
}
Server supports a new field
âweightâ.
27. Adding a new field âweightâ
{
"id": 8,
"name": "Apple"
}
{
"id": 8,
"name": "Apple",
"weight": 0.4
}
Client gets the new
field? Will he ignore it?
BREAKING?
28. Direction matters!
1. Where will be the new version deployed?
2. How are the requests/responses are affected?
29. Query Parameters
⢠Sequence does not matter
⢠Unknown parameters are ignored
⢠Should have defaults
TIP: Do not make a query parameter mandatory!
https://api.predic8.de/shop/products/?page=2&limit=10
https://www.google.com/?q=Helsinki&Foo=true
39. {
"name": "Mango",
"id": 57,
"weight": 0.7
}
public class Fruit {
Long id;
String name;
String language = âenâ;
}
Additional Properties
are ignored Default
Property order does
not matter.
40. Do not be strict!
@JsonIgnoreProperties(ignoreUnknown=false)
41. JSON (limitations)
â˘JSON has no versioning features
â˘Renaming of fields is not supported
â˘JSON can be read without a schema
⢠Oposed to Avro, ProtoBuf
51. Summary
⢠RESTful APIs do not need versioning, everyday APIs do
⢠JSON is good for compatibility
⢠Evolution not Revolution
⢠Swagger allows to compare versions