GAN-Based API Mocking for Realistic, Anonymized Sample Data
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional mocking services rely on limited and unrealistic fake data generation libraries, such as faker.js, which fail to produce diverse and accurately mimicked data, leading to potential failures in downstream API integrations and demos, and using real APIs risks data exposure and compliance violations.
Innovation Solution
Implement a mocking service utilizing a generative adversarial network (GAN) with a generator and discriminator function to train on real API requests and responses, generating realistic sample data that mimics actual API behavior, while ensuring data anonymization to maintain compliance.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Quantity of substance
If fake data generation libraries (e.g., faker.js) are used to generate sample data, then data quantity can be increased, but data quality and realism deteriorate
Solution Approach 1:
The patent uses a Generative Adversarial Network (GAN) where the generator learns to copy the statistical properties and patterns of real API data. The generator creates synthetic data that mimics the distribution, relationships, and characteristics of actual API responses, achieving both quantity and realism by learning from real data samples rather than using simple fake data libraries.
Solution Approach 2:
The GAN transforms the approach by changing from static fake data generation to dynamic parameter-based generation. The generator learns optimal parameter distributions from real data and generates realistic samples by sampling from these learned parameters, enabling high-quality data generation with unlimited quantity.
2Manufacturing precision
If real APIs are used for testing and development, then data realism is improved, but data security and compliance deteriorate
Solution Approach 1:
The patent introduces a GAN-based intermediary system that sits between real data sources and testing environments. The generator learns from real API data during training but generates synthetic data during inference, acting as a mediator that preserves data utility for testing while eliminating direct exposure to sensitive real data.
Solution Approach 2:
The system creates accurate copies of real data characteristics through the GAN training process. The generator learns to reproduce the statistical properties, relationships, and patterns of real API data without copying actual sensitive values, achieving realism while maintaining security through learned representations rather than direct replication.
3Device complexity
If simple fake data libraries are used, then device complexity is reduced, but data quality and diversity deteriorate
Solution Approach 1:
The patent replaces simple mechanical fake data libraries with a machine learning-based GAN system. This substitution enables the system to automatically learn data distributions, relationships, and patterns from real examples, generating diverse and adaptable synthetic data without requiring manual configuration or complex rule-based systems.
Data Source
AI summary
Methods, systems, apparatuses, devices, and computer program products are described. A mocking service may log a set of real application programming interface (API) data including a set of API requests and corresponding API responses. Using a generator function of a generative adversarial network (GAN), the mocking service may generate a set of sample (e.g., mock) data that mimics the API requests and responses. The mocking service may use a discriminator function to compare the sample data to the real API data and weight parameters of the GAN (e.g., retrain a machine learning model of the GAN) until the generator function generates sample data similar enough to the real API data. When the discriminator function is unable to distinguish the sample data, the real data, the mocking service may store the trained GAN and use it to generate mock API responses to API requests from users.


