GraphQL API Schema for Service Decoupling
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing API systems face inefficiencies in processing read and write requests due to differences in service conventions, leading to overfetching and underfetching, and require complex re-compilation and deployment with increasing numbers of services, which wastes resources and complicates maintenance.
Innovation Solution
The method involves generating data records based on object and service definitions, publishing messages on a message bus for data lake processing, and using declarative schemas to define APIs, allowing for efficient north-south and east-west data processing, decoupling services, and versioning data for consistency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If RESTful services are used to expose API functions, then services can be accessed programmatically via standard protocols, but overfetching and underfetching occur leading to data retrieval inefficiencies
Solution Approach 1:
The patent introduces a GraphQL layer as an intermediary between the client and RESTful services. This GraphQL API acts as a mediator that receives client queries, translates them into efficient service calls, and returns precisely the requested data. The GraphQL schema defines the data model and relationships, allowing clients to specify exactly what data they need without overfetching or underfetching, while the backend uses this schema to generate optimal service invocation plans.
2Adaptability or versatility
If individual service conventions are allowed to differ, then each service can be maintained independently, but significant challenges arise in the user interface layer that relies on multiple service APIs
Solution Approach 1:
The patent implements a universal GraphQL schema that serves as a common interface for all services. This schema acts as a multi-functional contract that can represent data from any service while maintaining a consistent structure. The schema includes type definitions, field definitions, and relationship definitions that work across all services, allowing the user interface to interact with a unified data model regardless of the underlying service heterogeneity.
Solution Approach 2:
The GraphQL layer serves as an intermediary that translates between diverse service conventions and a unified interface. It receives requests in a consistent format, determines which services need to be called, and returns data in a unified format. This mediator pattern allows services to maintain their independence while presenting a cohesive interface to the user layer.
3Adaptability or versatility
If the number of services in the API increases, then more functionality can be provided, but complex re-compilation and deployment is required which wastes resources and complicates maintenance
Solution Approach 1:
The patent segments the API into independent services, each with its own data model and logic, while using a centralized GraphQL schema that orchestrates them. The schema is divided into type definitions that can be independently maintained for each service, but combined to form a complete API. This segmentation allows services to be developed, compiled, and deployed independently while the GraphQL layer composes them into a unified interface.
Solution Approach 2:
The system dynamically generates service invocation plans based on the GraphQL schema and the specific query being executed. Rather than requiring static compilation of all possible service interactions, the system adapts the service call graph at runtime based on what data the client actually needs. This dynamic approach reduces unnecessary compilation and deployment complexity while maintaining full functionality.
Data Source
AI summary
Certain aspects of the present disclosure provide techniques for processing north-south queries in an application programming interface (API) generated for a plurality of associated services. The method generally includes receiving a request to invoke a function exposed by a first service in the API, wherein the function commits data to one or more data repositories. A data record is generated by the first service based on the received request based on a data object definition and a service definition for the first service. A message is generated including the generated data record and an indication that the message is to be consumed by a data lake processing system to commit data to a data lake. The message is published on a message bus for consumption by the data lake processing system.


