
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@nest-openapi/validator
Advanced tools
Automatic request/response validation for NestJS using your OpenAPI specifications
OpenAPI‑first utilities for NestJS
Single source of truth · Drop‑in for NestJS · Fast by design
fast-json-stringify serialization with caching and precompilation.| Package | Description | Version |
|---|---|---|
@nest-openapi/validator | Automatic request/response validation using your OpenAPI spec | |
@nest-openapi/serializer | High-performance response serialization based on your OpenAPI spec | |
@nest-openapi/mock | Spec-driven mock server for generating realistic mock responses | |
@nest-openapi/mcp | Spec-driven MCP server for exposing OpenAPI operations as tools |
npm i @nest-openapi/validator
import { Module } from "@nestjs/common";
import { OpenAPIValidatorModule } from "@nest-openapi/validator";
import * as openApiSpec from "./openapi.json";
@Module({
imports: [
OpenAPIValidatorModule.forRoot({
specSource: { type: "object", spec: openApiSpec },
}),
],
})
export class AppModule {}
All routes are automatically validated. See full documentation for advanced configuration.
npm i @nest-openapi/serializer
import { Module } from "@nestjs/common";
import { OpenAPISerializerModule } from "@nest-openapi/serializer";
import * as openApiSpec from "./openapi.json";
@Module({
imports: [
OpenAPISerializerModule.forRoot({
specSource: { type: "object", spec: openApiSpec },
responseSerialization: { enable: true, skipErrorResponses: true },
}),
],
})
export class AppModule {}
Responses are automatically serialized. See full documentation for advanced configuration.
npm i @nest-openapi/mock
import { Module } from "@nestjs/common";
import { OpenAPIMockModule } from "@nest-openapi/mock";
import * as openApiSpec from "./openapi.json";
@Module({
imports: [
OpenAPIMockModule.forRoot({
specSource: { type: "object", spec: openApiSpec },
enable: process.env.NODE_ENV === "development",
mockByDefault: true,
}),
],
})
export class AppModule {}
Routes return mocked responses when enabled. See full documentation for advanced configuration.
npm i @nest-openapi/mcp
import { Module } from "@nestjs/common";
import { OpenAPIMcpModule } from "@nest-openapi/mcp";
import * as openApiSpec from "./openapi.json";
@Module({
imports: [
OpenAPIMcpModule.forRoot({
specSource: { type: "object", spec: openApiSpec },
http: { path: "/mcp" },
executor: { baseUrl: "http://127.0.0.1:3000" },
}),
],
})
export class AppModule {}
Expose OpenAPI operations as MCP tools. See full documentation for advanced configuration.
import { Inject, Injectable } from "@nestjs/common";
import {
OPENAPI_VALIDATOR,
OpenAPIValidatorService,
} from "@nest-openapi/validator";
@Injectable()
export class MyService {
constructor(
@Inject(OPENAPI_VALIDATOR)
private readonly validator: OpenAPIValidatorService,
) {}
validate(ctx: HttpArgumentsHost) {
const errors = this.validator.validateRequest(ctx, { body: true });
if (errors.length > 0) {
// Handle validation errors
}
}
}
import { Controller, Post } from "@nestjs/common";
import { Validate } from "@nest-openapi/validator";
import { Serialize } from "@nest-openapi/serializer";
@Controller("books")
export class BooksController {
@Post()
@Validate({ request: { query: false }, response: true })
@Serialize({ disable: true })
create(@Body() dto: CreateBookDto): Book {
return this.booksService.create(dto);
}
}
Issues and PRs are welcome. Please check the package folders and docs before opening an issue.
MIT © @nest-openapi
FAQs
Automatic request/response validation for NestJS using your OpenAPI specifications
The npm package @nest-openapi/validator receives a total of 11 weekly downloads. As such, @nest-openapi/validator popularity was classified as not popular.
We found that @nest-openapi/validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.