📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

nestjs-config-zod-validation

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-config-zod-validation

A simple Zod Validation shim for NestJS ConfigService

1.1.1
latest
Source
npm
Version published
Weekly downloads
20
81.82%
Maintainers
1
Weekly downloads
 
Created
Source

nestjs-config-zod-validation

A simple Zod Validation shim for NestJS ConfigService

import { validationSchema, validationOptions } from "nestjs-config-zod-validation"

@Module({
  imports: [
    ConfigModule.forRoot({
      validationSchema: validationSchema(ConfigSchema), // Pass in your ZodSchema "Schema" here
      validationOptions: validationOptions,
    }),
  ],
})

Then upon start up you will get any validation errors if any, for example:

ZodError: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      "SOME_ZOD_VARIABLE",
    ],
    "message": "Required"
  }
]

Keywords

nestjs

FAQs

Package last updated on 07 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts