Many people use REST / gRPC • For internal API protocol, GraphQL is currently not a popular choice • Of course, REST (JSON over HTTP) and gRPC are very good options
3 reasons why we should use GraphQL for service-to-service API protocol • 1. Easy to evolve our services • 2. Good API Interface and documentation system
• 3. Easy to make GraphQL Aggregation Layer for Frontend
Response Body { "a": 1, "b": 2, "c": 3 } A bad example (in Ruby) • It's not tolerant because it will be broken by just adding a new field to the API payload
Persisted Query • Persisted Query can be regarded as Contract • Provider can check the persisted queries, and know what kind of fields are being used now
• Provider can write tests to assure these queries can be used correctly, and run them in CI (≒ Consumer-driven Contract Testing)