{"id":26826938,"url":"https://github.com/gautierdag/serverless-plugin-ts-validation","last_synced_at":"2026-05-01T09:32:40.815Z","repository":{"id":37818994,"uuid":"247460003","full_name":"gautierdag/serverless-plugin-ts-validation","owner":"gautierdag","description":"Serverless plugin to generate validation JSON schemas from Typescript interfaces","archived":false,"fork":false,"pushed_at":"2023-01-17T11:01:45.000Z","size":208,"stargazers_count":1,"open_issues_count":20,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-09T04:19:02.933Z","etag":null,"topics":["aws","lambda","schema","serverless","serverless-plugin","validation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gautierdag.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-15T12:14:57.000Z","updated_at":"2021-04-29T08:37:45.000Z","dependencies_parsed_at":"2023-02-10T09:15:19.279Z","dependency_job_id":null,"html_url":"https://github.com/gautierdag/serverless-plugin-ts-validation","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gautierdag%2Fserverless-plugin-ts-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gautierdag%2Fserverless-plugin-ts-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gautierdag%2Fserverless-plugin-ts-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gautierdag%2Fserverless-plugin-ts-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gautierdag","download_url":"https://codeload.github.com/gautierdag/serverless-plugin-ts-validation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246314011,"owners_count":20757450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","lambda","schema","serverless","serverless-plugin","validation"],"created_at":"2025-03-30T11:31:40.119Z","updated_at":"2026-05-01T09:32:35.793Z","avatar_url":"https://github.com/gautierdag.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serverless-plugin-ts-validation\n\n[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)\n[![npm version](https://badge.fury.io/js/serverless-plugin-ts-validation.svg)](https://badge.fury.io/js/serverless-plugin-ts-validation)\n[![Build Status](https://travis-ci.com/gautierdag/serverless-plugin-ts-validation.svg?branch=master)](https://travis-ci.com/gautierdag/serverless-plugin-ts-validation)\n\nThis is a serverless plugin made to enable automatic validation of your AWS lambda functions from typescript interfaces.\n\nThis plugin should be compatible with other plugins such as the `serverless-plugin-typescript`.\n\nUnder the hood it uses the `ts-json-schema-generator` library to generate a json schema from an interface, and sends it to AWS proxy as an input validator.\n\nThe validation enables AWS proxy to validate the input, without needing the lambda functions to be called (saving you some money 💰) and ensuring the inputs to your functions are valid.\n\n## How to use\n\nDefine a typescript interface which you would like to use as your validation:\n\n`src/user-schema.interface.ts`\n\n```ts\nexport interface UserSchema {\n  id: number;\n  name: string;\n}\n```\n\nIn your `serverless.yml`, you can add the validation as follows:\n\n```yml\nplugins:\n  - serverless-plugin-ts-validation\n---\n\n---\n\n---\nfunctions:\n  getUser:\n    handler: getUser.handler\n    events:\n      - http:\n          path: /user\n          method: post\n          request:\n            schema:\n              application/json:\n                tsPath: src/user-schema.interface.ts\n                tsInterface: UserSchema\n```\n\nYou simply have to precise the `tsPath` and `tsInterface` to use to generate the json-schema. The parsing will be done automatically using the `ts-json-schema-generator` library.\n\nWhen you then pass requests to the route `user` with a content type of `application/json` the passed body will be validated to check for the `id` and `name` attributes.\n\n## Notes:\n\n- This currently works for simple cases, but since the json schema we create is version 7.0, and AWS only supports version 4.0, there might be cases where AWS rejects the schema generated.\n- The schema files are not currently stored locally, this could be a potential future feature.\n- There are no provided default `tsconfig.json`, you will need to provide your own in the root directory.\n\nThis plugin would not have been possible without:\n\n- `ts-json-schema-generator`\n- `serverless-plugin-typescript`\n\n## PRs welcomed! 🙂\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgautierdag%2Fserverless-plugin-ts-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgautierdag%2Fserverless-plugin-ts-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgautierdag%2Fserverless-plugin-ts-validation/lists"}