Module: models/dryRunValidator

Validating a syntactically correct imposter creation statically is quite difficult.
This module validates dynamically by running test requests through each predicate and each stub
to see if it throws an error. A valid request is one that passes the dry run error-free.

Source:

Methods

(async) validate(request, logger) → {Object}

Validates that the imposter creation is syntactically valid

Parameters:
Name Type Description
request Object

The request containing the imposter definition

logger Object

The logger

Source:
Returns:

Promise resolving to an object containing isValid and an errors array

Type
Object

(inner) create(options) → {Object}

Creates the validator

Parameters:
Name Type Description
options Object

Configuration for the validator

Properties
Name Type Description
testRequest Object

The protocol-specific request used for each dry run

testProxyResponse Object

The protocol-specific fake response from a proxy call

allowInjection boolean

Whether JavaScript injection is allowed or not

additionalValidation function

A function that performs protocol-specific validation

Source:
Returns:
Type
Object