Skip to content

Instantly share code, notes, and snippets.

@stereobooster
Last active October 24, 2017 15:52
Show Gist options
  • Save stereobooster/6111b0f9c42ca9a6e3a53f5c56059333 to your computer and use it in GitHub Desktop.
Save stereobooster/6111b0f9c42ca9a6e3a53f5c56059333 to your computer and use it in GitHub Desktop.
REST-GRPC-GraphQL-etc
GraphQL ion proto bufs json capnproto jsonschema cbro MsgPack avro thrift lave ljson jsonet flatbuffers
type plain/binary binary plain binary plain binary binary binary binary plain plain plain binary
schema + - + + - - + +
Zero-copy - - + - +/- - - - +
Random-access reads - - + - - - - +
Safe against malicious input + + +
Schema language + custom - custom JSON - - Avro IDL - - - custom
Null + + + + + + + +
Not null +
ineteger + + + + + + + + + (32, 64) + + + + +
string + + + + + + + + +
float + + + + + + (32, 64) + + +
bigdecimal - + -(ext) + - - -
timestamp + - + -(ext) + - -
binary + - + + - -
s-exp + - - - - - - -
array + + + + + + + +
object/map + + + + + + + +
boolean + + + + + + + +
functions - - - + + -
Graph/Circular/Relational data + (s-exp) - - - + +
Enum + +
Union +
ID +
URI +
Regexp +
comments - - - - - - - -
human-readable + - + - + - - - - + + + -
human-writable - - - - - - - - - - - - -
streaming +/- +/- +/- +/- +/-
user defined types + - +

Formats

JSON-based

Zero-copy

Config

GraphQL

GRPC

Other

network & compression

API design

Lmabda/Kappa architecture

Graph representation capabalities

Types

  • Trees - special case of Directed Acyclic Graphs (DAG), node can have only one parrent
  • Directed Acyclic Graphs
  • General cyclic graphs

Strategies

  • Embeding everything, like HAL. Not able to represent cyclic graphs
  • Flattening strategy plus path/IDs, like JSON API, jsonet, lave, arson

Graph query languages


REST GraphQL GRPC JSON API SQL'
concept CRUD R from CRUD + RPC RPC CRUD CRUD
single/multiple entry points multiple single single multiple single
data format not spec any extensible protobuf json custom
data transport HTTP any HTTP2 HTTP TCP
Fetching Relationships not specified + + +
Inclusion of Related Resources not specified + + +/-
Sparse Fieldsets not specified + + +
Sorting not specified + +
Pagination not specified +/- + +
Filtering not specified + + +
Idempotence not specified -
Schema not specified ? + JSONSchema SQL
Streaming - -
Caching + -
Authentication basic/OAuth/etc basic/OAuth/etc basic/OAuth/etc basic
Authorization
Transactions - (stateless) +
Metadata" headers headers/? +
Browser support + + +/- + -
N+1 problem + - +/- - +/-
Graph querying -? -("GraphQL+-") +/- -? -
Data not specified graph graph tuples
Reactiveness - -(not yet) - - -
Not null +

' SQL is for comparison. The point is that we just keep reinventing SQL agaian and again

" Metadata - Request-Id, info about rate limit, etc.

Recources vs functions

Resourcefull API is like SQL, as soon as you define resource you get CRUD and all other goodnes like, pagination, sparse fields, etc

  • CRUD CREATE, SELECT, UPDATE, DELETE
  • sparse fileds: SELECT a,b
  • pagination LIMIT, or cursors
  • sorting SORT BY
  • filtering WHERE
  • schema CREATE TABLE

Reactive/Pub-Sub dbs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment