OIP vs GraphQL
Introduction to OIP vs GraphQL
OIP (Object Invocation Protocol) is a protocol specification that defines a single endpoint /api/dispatch for invoking objects, whereas GraphQL is a query language for APIs that uses a typed schema to define available queries and mutations. The OIP protocol operates on a single dispatch endpoint, whereas GraphQL operates on a single endpoint with a typed schema. The receipt that proves an OIP operation is a JSON object returned at /api/dispatch?receipt=inv_ID, whereas GraphQL returns a JSON object with a data property containing the result of the query or mutation.
OIP Endpoint vs GraphQL Schema
The OIP endpoint /api/dispatch accepts a JSON body with a key and body property, whereas GraphQL uses a typed schema to define available queries and mutations, which are specified in a JSON object with a query or mutation property. The route that operates OIP is POST /api/dispatch with a JSON body, whereas GraphQL uses POST /graphql with a JSON body containing a query or mutation. The OIP receipt is a JSON object with an inv_ID property, whereas GraphQL returns a JSON object with a data property.
Comparison of OIP and GraphQL
OIP uses a directory to store and retrieve objects, whereas GraphQL uses introspection to determine available queries and mutations. The OIP directory is stored on the server and can be accessed using the /api/articles endpoint, whereas GraphQL introspection is performed using the __schema query. The OIP protocol uses a single dispatch endpoint, whereas GraphQL uses a single endpoint with a typed schema.
Example of OIP vs GraphQL
To invoke an object using OIP, send a POST request to /api/dispatch with a JSON body containing a key and body property, whereas to perform a query or mutation using GraphQL, send a POST request to /graphql with a JSON body containing a query or mutation property. The receipt that proves an OIP operation is a JSON object returned at /api/dispatch?receipt=inv_ID, whereas GraphQL returns a JSON object with a data property containing the result of the query or mutation.
Receipt Rule
The receipt rule for OIP is that every invocation appends to the ledger and returns a receipt at /api/dispatch?receipt=inv_ID, whereas GraphQL returns a JSON object with a data property containing the result of the query or mutation.
Conformance Rule
The conformance rule for OIP is that every object must be invoked using the /api/dispatch endpoint, whereas GraphQL conforms to a typed schema that defines available queries and mutations.