@kravc/dos 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kravc/dos",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Convention-based, easy-to-use library for building API-driven serverless services.",
5
5
  "keywords": [
6
6
  "Service",
@@ -25,7 +25,7 @@
25
25
  "author": "Alexander Kravets <a@kra.vc>",
26
26
  "license": "ISC",
27
27
  "dependencies": {
28
- "@kravc/schema": "^2.4.0",
28
+ "@kravc/schema": "^2.5.1",
29
29
  "cookie": "^0.5.0",
30
30
  "js-yaml": "^4.1.0",
31
31
  "jsonwebtoken": "^9.0.2",
package/src/Service.js CHANGED
@@ -107,7 +107,8 @@ class Service {
107
107
  if (!Operation) { throw new OperationNotFoundError({ operationId, httpMethod, httpPath }) }
108
108
 
109
109
  context.identity = await authorize(Operation, context)
110
- const parameters = this._getParameters(Operation.inputSchema, context)
110
+ const isUpdate = Operation.type === Operation.types.UPDATE
111
+ const parameters = this._getParameters(Operation.inputSchema, context, isUpdate)
111
112
 
112
113
  const operation = new Operation(context)
113
114
  response = await operation.exec(parameters)
@@ -143,7 +144,7 @@ class Service {
143
144
  return { statusCode, headers, multiValueHeaders, body }
144
145
  }
145
146
 
146
- _getParameters(inputSchema, context) {
147
+ _getParameters(inputSchema, context, shouldNullifyEmptyValues) {
147
148
  if (!inputSchema) { return {} }
148
149
 
149
150
  const { query, mutation } = context
@@ -152,7 +153,7 @@ class Service {
152
153
  let result
153
154
 
154
155
  try {
155
- result = this._validator.validate(input, inputSchema.id)
156
+ result = this._validator.validate(input, inputSchema.id, shouldNullifyEmptyValues)
156
157
 
157
158
  } catch (validationError) {
158
159
  throw new InvalidInputError(validationError, context)
@@ -30,3 +30,4 @@ error:
30
30
 
31
31
  path:
32
32
  description: Path of invalid attribute
33
+ type: array