# US 2021/0279115 A1 · Automated api code generation

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0279115 A1
- Document ID: US20210279115A1
- Status: Published application
- Kind: A1
- Application number: 16/808,215
- Filed: 2020-03-03
- Published: 2021-09-09
- Earliest claimed: 2020-03-03
- Assignees: The Toronto-Dominion Bank
- Applicants: The Toronto-Dominion Bank
- Inventors: Salvatore Aspro; George Wright
- Web page: https://patentgrep.com/patent/US20210279115A1

## CPC

- G06F 9/54: Interprogram communication
- G06F 9/541: {via adapters, e.g. between incompatible applications}
- G06F 8/10: Requirements analysis; Specification techniques
- G06F 8/30: Creation or generation of source code
- G06F 8/36: Software reuse
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An API generation system can be used to generate complete (or almost complete) APIs in response to received requests for new or modified APIs. Received API generation requests can include API descriptive data which is augmented to generate a set of data requirements defining one or more inputs and outputs for the API. The API functions can be mapped to one of a set of reference data models defining data types as used by the backend system, and the mappings used to automatically generate an API design defining input and output parameters for each API function of the requested API. The API generation system then assembles a code foundation for the requested API based on a set of software components implementing a portion of the API function and generates API source code based on the code foundation to complete the requested API.

## Claims

### Claim 1

A system for automatic generation of an Application Programming Interface (API), the system comprising:
a processor; and
a non-transitory computer readable storage medium comprising instructions which, when executed by the processor, cause the processor to perform the steps of:
receiving API descriptive data including partial data requirements for an API;
maintaining a data type lexicon constructed based on data requirements of a set of existing APIs of a backend system, the data type lexicon comprising a set of data type definitions used by the backend system;
matching one or more inputs or outputs described in the partial data requirements to data types of the data type definitions of the data type lexicon;
generating, based the partial data requirements and the matched data types, a set of data requirements for the API, the set of data requirements defining one or more inputs and outputs for an API function of the API;
mapping the API function to one or more a reference data models based on the set of data requirements, each reference data model associated with a data type used by the API function;
determining one or more input and output parameters for the API function based on the reference data model and the set of data requirements;
assembling a code foundation for the API based on the identified input and output parameters, the code foundation comprising one or more software components, each component implementing a portion of the API function; and
generating source code for the API based on the one or more software components and the input and output parameters.

### Claim 2 (depends on 1)

The system of claim 1, wherein the instructions further cause the processor to perform the step of:
extracting, from the API descriptive data the partial data requirements.

### Claim 3

(canceled)

### Claim 4

(canceled)

### Claim 5 (depends on 1)

The system of claim 1, wherein the API is to be implemented on a backend system and the reference data model defines a schema of the data type as used in the backend system.

### Claim 6 (depends on 1)

The system of claim 1, wherein determining one or more input and output parameters for the API function comprises:
generating an API specification for the API.

### Claim 7 (depends on 6)

The system of claim 6, wherein the API specification is an API specification based on a standard selected from the set consisting of RAML (RESTful API Modeling Language), Swagger, and OpenAPI specification.

### Claim 8 (depends on 6)

The system of claim 6, further comprising:
determining a framework for source code associated with the API based on the API specification.

### Claim 9 (depends on 1)

The system of claim 1, wherein a software component of the one or more software components comprises a code segment for importing a library.

### Claim 10 (depends on 1)

The system of claim 1, wherein a software component of the one or more software components comprises a code segment for translating data from an input format to an output format.

### Claim 11

A method for automatic generation of an Application Programming Interface (API), the method comprising:
receiving API descriptive data including partial data requirements for an API;
maintaining a data type lexicon constructed based on data requirements of a set of existing APIs of a backend system, the data type lexicon comprising a set of data type definitions used by the backend system;
matching one or more inputs or outputs described in the partial data requirements to data types of the data type definitions of the data type lexicon;
generating, based the partial data requirements and the matched data types, a set of data requirements for the API, the set of data requirements defining one or more inputs and outputs for an API function of the API;
mapping the API function to one or more a reference data models based on the set of data requirements, each reference data model associated with a data type used by the API function;
determining one or more input and output parameters for the API function based on the reference data model and the set of data requirements;
assembling a code foundation for the API based on the identified input and output parameters, the code foundation comprising one or more software components, each component implementing a portion of the API function; and
generating source code for the API based on the one or more software components and the input and output parameters.

### Claim 12 (depends on 11)

The method of claim 11, further comprising:
extracting, from the API descriptive data the partial data requirements.

### Claim 13

(canceled)

### Claim 14

(canceled)

### Claim 15 (depends on 11)

The method of claim 11, wherein the API is to be implemented on a backend system and the reference data model defines a schema of the data type as used in the backend system.

### Claim 16 (depends on 11)

The method of claim 11, wherein determining one or more input and output parameters for the API function comprises:
generating an API specification for the API.

### Claim 17 (depends on 16)

The method of claim 16, wherein the API specification is an API specification based on a standard chosen from the set of RAML (RESTful API Modeling Language), Swagger, and OpenAPI specification.

### Claim 18 (depends on 16)

The method of claim 16, further comprising:
determining a framework for source code associated with the API based on the API specification.

### Claim 19 (depends on 11)

The method of claim 11, wherein a software component of the one or more software components comprises a code segment for importing a library.

### Claim 20 (depends on 11)

The method of claim 11, wherein a software component of the one or more software components comprises a code segment for translating data from an input format to an output format.
