Application programming interface simulation based on declarative annotations
Assigneesalesforce.com, inc.
InventorsBilly Ma, Jules Wada, Vandit Garg
Life of this patent
Estimating the term…
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.
Claims20
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.
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.
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.
Dependencies are inferred from the claim text.