# US 11,030,082 B1 · Application programming interface simulation based on declarative annotations

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

- Number: US 11,030,082 B1
- Document ID: US11030082B1
- Status: Granted
- Kind: B1
- Application number: 16/991,972
- Filed: 2020-08-12
- Granted: 2021-06-08
- Earliest claimed: 2020-08-12
- Assignees: salesforce.com, inc.
- Applicants: salesforce.com, inc.
- Inventors: Billy Ma; Jules Wada; Vandit Garg
- Web page: https://patentgrep.com/patent/US11030082B1

## CPC

- G06F 8/36: Software reuse
- G06F 11/3698: Environments for analysis, debugging or testing of software
- G06F 8/313: {Logic programming, e.g. PROLOG programming language}
- G06F 9/449: {Object-oriented method invocation or resolution}
- G06F 11/3696: {Methods or tools to render software testable}
- G06F 9/455: Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F 2201/80: Database-specific techniques
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An application programming interface (API) simulator generates synthetic responses for use during development and testing of subsystems. The API simulator receives an API schema including annotations that specify constraints on the synthetic responses. The API simulator generates synthetic responses as results of APIs that conform to the constraints specified using the annotations. The use of API simulator allows testing of subsystems using realistic synthetic responses that satisfy specific constraints as specified using annotations of the API schema.

## Claims

### Claim 1

A computer implemented method for application programming interface (API) simulation, the method comprising:
receiving, by an application programming interface (API) simulator, a description of an API schema comprising a set of methods, the description comprising, for each method:
(1) a set of input parameters,
(2) a schema of a response object, and
(3) one or more annotations, each annotation representing a constraint on the response object of the method, at least one annotation specifying a constraint based on an input parameter;
receiving, by the API simulator, a request for an invocation of a method of the API schema, the request specifying a set of values for input parameters of the method;
accessing, by the API simulator, the one or more annotations for the method as specified in the description of the API schema;
generating, by the API simulator, a synthetic response object for the method invocation, the generating comprising, assigning a value to each attribute of the synthetic response object, wherein the assigned value satisfies constraints specified by the one or more annotations; and
providing, by the API simulator, the synthetic response object as a result of the invocation of the method.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein generating the synthetic response object comprises determining a value of an attribute of the object as a function of the input parameter.

### Claim 3 (depends on 1)

The computer-implemented method of claim 1, wherein the synthetic response object comprises a set of values, wherein the generating the synthetic response object comprises limiting the number of elements in the set of values based on the input parameter.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, wherein the synthetic response object comprises a set of values, wherein the generating the synthetic response object comprises sorting elements of the set of values in an order determined by the input parameter.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein generating the synthetic response object comprises setting a value of an attribute of the object to the value of the input parameter.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein the synthetic response object is a nested object and the annotation identifies an attribute of the synthetic response object by specifying a path of the attribute within the nested object.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, wherein the synthetic response object comprises a set of values and the annotation specifies pagination of the set of values based on a limit, wherein generating the synthetic response object comprises generating a set of values having a cardinality matching the limit.

### Claim 8 (depends on 1)

The computer-implemented method of claim 1, wherein the annotation identifies an attribute of the object and a source of data, wherein generating the synthetic response object comprises setting the attribute of the synthetic response object based on one or more values obtained from the source of data.

### Claim 9 (depends on 1)

The computer-implemented method of claim 1, wherein the annotation identifies an attribute of the object and identifies an enumerated list of values, wherein generating the synthetic response object comprises setting the attribute of the synthetic response object based a value obtained from the enumerated list of values.

### Claim 10 (depends on 1)

The computer-implemented method of claim 1, wherein the annotation specifies a format for an attribute of the response object, the format specified using an expression.

### Claim 11 (depends on 1)

The computer-implemented method of claim 1, method for application programming interface (API) simulation, further comprising:
sorting attributes of the synthetic response based on the dependencies in the attributes; and
populating the attributes according to the sorted order.

### Claim 12 (depends on 1)

The computer-implemented method of claim 1, further comprising:
receiving, by an application programming interface (API) simulator, a second specification describing a signature of the method and a second annotation;
receiving, by the API simulator, a second request for invocation of the method, the second request specifying the set of values; and
generating a second synthetic response object conforming to the constraint based on the second annotation.

### Claim 13 (depends on 1)

The computer-implemented method of claim 1, wherein the annotation is specified using a declarative language.

### Claim 14

A non-transitory computer readable storage medium for storing instructions that when executed by a computer processor cause the computer processor to perform steps for performing predictions, the steps comprising:
receiving, by an application programming interface (API) simulator, a description of an API schema comprising a set of methods, the description comprising, for each method:
(1) a set of input parameters,
(2) a schema of a response object, and
(3) one or more annotations, each annotation representing a constraint on the response object of the method, at least one annotation specifying a constraint based on an input parameter;
receiving, by the API simulator, a request for an invocation of a method of the API schema, the request specifying a set of values for input parameters of the method;
accessing, by the API simulator, the one or more annotations for the method as specified in the description of the API schema;
generating, by the API simulator, a synthetic response object for the method invocation, the generating comprising, assigning a value to each attribute of the synthetic response object, wherein the assigned value satisfies constraints specified by the one or more annotations; and
providing, by the API simulator, the synthetic response object as a result of the invocation of the method.

### Claim 15 (depends on 14)

The non-transitory computer readable storage medium of claim 14, wherein the synthetic response object comprises a set of values and the annotation specifies pagination of the set of values based on a limit, wherein generating the synthetic response object comprises generating a set of values having a cardinality matching the limit.

### Claim 16 (depends on 14)

The non-transitory computer readable storage medium of claim 14, wherein the annotation identifies an attribute of the object and a source of data, wherein generating the synthetic response object comprises setting the attribute of the synthetic response object based on one or more values obtained from the source of data.

### Claim 17 (depends on 14)

The non-transitory computer readable storage medium of claim 14, wherein generating the synthetic response object comprises determining a value of an attribute of the object as a method of the input parameter.

### Claim 18 (depends on 14)

The non-transitory computer readable storage medium of claim 14, wherein the synthetic response object comprises a set of values, wherein the generating the synthetic response object comprises limiting the number of elements in the set of values based on the input parameter.

### Claim 19 (depends on 14)

The non-transitory computer readable storage medium of claim 14, wherein the synthetic response object comprises a set of values, wherein the generating the synthetic response object comprises sorting elements of the set of values in an order determined by the input parameter.

### Claim 20

A computer system comprising:
a computer processor; and
a non-transitory computer readable storage medium for storing instructions that when executed by a computer processor cause the computer processor to perform steps for performing predictions, the steps comprising:
receiving, by an application programming interface (API) simulator, a description of an API schema comprising a set of methods, the description comprising, for each method:
(1) a set of input parameters,
(2) a schema of a response object, and
(3) one or more annotations, each annotation representing a constraint on the response object of the method, at least one annotation specifying a constraint based on an input parameter;
receiving, by the API simulator, a request for an invocation of a method of the API schema, the request specifying a set of values for input parameters of the method;
accessing, by the API simulator, the one or more annotations for the method as specified in the description of the API schema;
generating, by the API simulator, a synthetic response object for the method invocation, the generating comprising, assigning a value to each attribute of the synthetic response object, wherein the assigned value satisfies constraints specified by the one or more annotations; and
providing, by the API simulator, the synthetic response object as a result of the invocation of the method.
