Translations:NPM module - izara-middleware/32/en: Difference between revisions
Jump to navigation
Jump to search
(Importing a new version from external source) |
(No difference)
|
Latest revision as of 04:33, 4 October 2022
We use the validator middleware to:
- validate input is the correct type etc..
- define defaults for optional properties
- strip out unexpected properties using
ajvOptions: { removeAdditional: true }option and"additionalProperties: false"in the schema - 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.