Automated JSON Schema Generation from API Payloads

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Generating JSON schemas for undocumented API endpoints is challenging, as existing solutions require manual effort and are time-consuming, especially for API endpoints developed before OpenAPI standards, making it difficult for developers to utilize and maintain these endpoints efficiently.

Innovation Solution

An automated system that generates JSON schemas based on multiple payloads, using a schema builder that analyzes and merges payloads to determine field characteristics and data types, allowing for efficient documentation of API endpoints without manual intervention and enabling updates to JSON schemas in response to changes.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If existing solutions generate JSON schema one payload at a time manually, then the schema generation process is simple and straightforward, but the process is time-consuming and inefficient

Engineering Contradiction:
Improveschema generation efficiencyVSAvoidtime for manual schema generation
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The system performs preliminary actions by automatically retrieving multiple JSON payloads from the datastore before schema generation begins. This preliminary data collection enables the subsequent automated schema generation process to work with comprehensive payload sets, significantly improving efficiency compared to manual one-payload-at-a-time processing

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system enables self-service by automatically generating JSON schemas without requiring manual user intervention. The schema builder autonomously retrieves payloads, analyzes their structure, and generates schemas, eliminating the need for developers to manually copy-paste payloads into editors or import them into packages

Inventive Principle:
Principle #25Self-service

2Productivity

If automated schema generation is implemented, then schema generation efficiency is improved, but the system complexity increases

Engineering Contradiction:
Improveautomated schema generation speedVSAvoidcomplexity of automated system
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The schema builder is designed as a universal system that can handle multiple payloads for the same endpoint simultaneously. It performs multiple functions: retrieving payloads from datastore, analyzing their structure, determining field characteristics, and generating schemas. This multi-functionality consolidates what would otherwise require multiple separate tools into a single automated system

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The patent introduces a logging tool as an intermediary component that facilitates the automated schema generation process. The logging tool retrieves request IDs from logs and enables the schema builder to access multiple payloads systematically. This intermediary simplifies the complexity by providing a structured approach to payload retrieval rather than direct complex querying

Inventive Principle:
Principle #24Intermediary (Mediator)

3Measurement precision

If multiple payloads are processed together, then the generated schema is more comprehensive and accurate, but the processing complexity increases

Engineering Contradiction:
Improveschema accuracyVSAvoidcomplexity of payload analysis
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The schema generation process is segmented into distinct analytical steps: retrieving multiple payloads, analyzing their individual structures, identifying common fields and variations, determining field characteristics (required/optional, data types, formats), and synthesizing the final schema. This segmentation makes the complex task of processing multiple payloads manageable and systematic

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system determines field characteristics by analyzing parameter variations across multiple payloads. It identifies whether fields are required or optional based on their presence/absence patterns, determines data types by examining value formats, and identifies field formats by analyzing structural patterns. These parameter changes in the analysis approach enable accurate schema generation from variable payload sets

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS10803029B2Generating javascript object notation (JSON) schema from JSON payloads
Publication Date: 2020.10.13 SALESFORCE INC
  • US10803029B2 patent drawing
  • US10803029B2 patent drawing
  • US10803029B2 patent drawing

AI summary

Implementations of the invention generate a JavaScript Object Notation (JSON) schema for an application programming interface (API) endpoint that is not documented in a machine understandable schema. In one implementation, a plurality of JSON payloads that were successfully requested using a same endpoint are automatically obtained, and a composite payload is automatically created based on the plurality of JSON payloads that were obtained. Then a JSON schema that documents the API endpoint is automatically generated based on the composite payload. The generating comprises for each field of the composite payload, determining whether the field is optional or mandatory based on a number of the data items that are in the composite payload for the field, and determining a data type of the field based on the data items in the composite payload for the field.