Translations:NPM module - izara-middleware/32/en

From Izara Wiki
Jump to navigation Jump to search

We use the validator middleware to:

  1. validate input is the correct type etc..
  2. define defaults for optional properties
  3. strip out unexpected properties using ajvOptions: { removeAdditional: true } option and "additionalProperties: false" in the schema
  4. juggle the location of properties in the request, eg for API requests the current userId will be placed in the requestContext.authorizer.principalId property, we move it to the event.userId location. After moving the userId property we also remove the requestContext property as we have no other use for it in our code.