openapi-enforcer
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -212,3 +212,3 @@ /** | ||
function randomBuffer (divider) { | ||
return function (schema, { randomNumber }) { | ||
return function ({ schema }, { randomNumber }) { | ||
const hasMin = schema.hasOwnProperty('minLength'); | ||
@@ -239,3 +239,3 @@ const hasMax = schema.hasOwnProperty('maxLength'); | ||
function randomDate(schema, { randomNumber }) { | ||
function randomDate({ schema }, { randomNumber }) { | ||
const fiveYears = 157248000000; // 5 years in milliseconds | ||
@@ -242,0 +242,0 @@ const hasMin = schema.hasOwnProperty('minimum'); |
@@ -140,3 +140,3 @@ /** | ||
if (dataType) { | ||
parent[property] = dataType.random(schema, { chooseOne, randomNumber, randomText }); | ||
parent[property] = dataType.random({ exception, schema }, { chooseOne, randomNumber, randomText }); | ||
@@ -143,0 +143,0 @@ } else if (type === 'boolean') { |
@@ -292,11 +292,11 @@ # Schema | ||
- *deserialize* [`function`] - The function to call to deserialize the value. It receives two parameters: `exception` for reporting errors and `value` which contains the serialized value. This function should return the deserialized value. Within the function `this` is the schema instance. | ||
- *deserialize* [`function`] - The function to call to deserialize the value. It receives one parameter, an object, with properties `exception`, `schema`, and `value` which contains the serialized value. This function should return the deserialized value. | ||
- *isNumeric* [`boolean`] - If this value is numeric then it allows the schema properties `maximum`, `minimum`, `exclusiveMaximum`, `exclusiveMinimum`, and `multipleOf`. Defaults to `true` if the type is `integer` or `number`, otherwise `false`. | ||
- *random* [`function`] - The function to call to generate a random deserialized value. It receives one parameter, `exception` for reporting errors. The function should return the deserialized value. Within the function `this` is the schema instance. | ||
- *random* [`function`] - The function to call to generate a random deserialized value. It receives one parameter, an object, with properties `exception` and `schema`. The function should return the deserialized value. | ||
- *serialize* [`function`] - The function to call to serialize the value. It receives two parameters: `exception` for reporting errors and `value` which contains the deserialized value. This function should return the serialized value. Within the function `this` is the schema instance. | ||
- *serialize* [`function`] - The function to call to serialize the value. It receives one parameter, an object, with properties `exception`, `schema`, and `value` which contains the deserialized value. This function should return the serialized value. | ||
- *validate* [`function`] - The function to call to validate the deserialized value. It receives two parameters: `exception` for reporting errors and `value` which contains the deserialized value. This function does not need to return anything. | ||
- *validate* [`function`] - The function to call to validate the deserialized value. It receives one parameter, and object, with the properties `exception`, `schema`, and `value` which contains the deserialized value. This function does not need to return anything and can report errors via the `exception` object. | ||
@@ -303,0 +303,0 @@ **Returns:** `undefined`. |
{ | ||
"name": "openapi-enforcer", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Library for validating, parsing, and formatting data against open api schemas.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
725375