# aws-lambda-handlers-ajv

> AJV validator for the AWS lambda handlers

Latest version **1.0.2** (published 2023-01-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install aws-lambda-handlers-ajv
pnpm add aws-lambda-handlers-ajv
yarn add aws-lambda-handlers-ajv
bun add aws-lambda-handlers-ajv
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-01-30 |
| First published | 2023-01-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Norman Pellet |
| Maintainers | npellet |
| Keywords | lambda, aws, ajv, validation, schema |

## Links

- npm: https://www.npmjs.com/package/aws-lambda-handlers-ajv
- npm.io page: https://npm.io/package/aws-lambda-handlers-ajv

## Dependencies (1)

- [ajv](https://npm.io/package/ajv.md) ^8.12.0

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2023-01-30
- 1.0.1 — 2023-01-30

## README

# Yup validation for AWS Lambda Handlers

Validation helper bundling AJV used for [aws-lambda-handlers](https://www.npmjs.com/package/aws-lambda-handlers)

## Installation

```
npm i aws-lambda-handlers-ajv
```

## Usage

```typescript
import ajvValidation from 'aws-lambda-handlers-ajv';
import { LambdaFactoryManager } from 'aws-lambda-handlers';

const mgr = new LambdaFactoryManager();
// ...Compose mgr with other methods at wish

const mgrWithValidation = ajvValidation( mgr );

export default mgrWithValidation;
```

The validator can then be used for runtime schema validation

```typescript
import mgr from '/path/to/manager'

const schema = {
    type: "object",
    properties: {
        keyStr: {
            type: "string"
        },
        keyNum: {
            type: "number"
        }
    }
} as const;

const { handler } = mgr
    .apiGatewayWrapperFactory('handler')
    .setTsInputType<JTDDataType<typeof schema>>()
    .validateInput("ajv", schema) // <== Note this line here
    .wrapFunc( async () => {
        //... Function logic
    })
```

---
_Source: https://npm.io/package/aws-lambda-handlers-ajv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
