Skip to content

Instantly share code, notes, and snippets.

@josephdpurcell
josephdpurcell / README.md
Last active July 8, 2024 09:36
NestJS: Ignore global ValidationPipe interceptor for a controller route

What is this?

This is an example of how to ignore a global validation pipe for a specific parameter, e.g. a request body. In fact, this example just shows a request body but you could apply this principle to other decorators.

This approach assumes validateCustomDecorators: false in the global validation pipe. If validateCustomDecorators is true in the global pipe I think you're out of luck. If that is your situation, consider refactoring so that validateCustomDecorators is false in the global pipe and then have each custom decorator add validation if it needs it.

How does this work?

The NestJS ValidationPipe does not validate custom decorators. So, in this above example we just make a @RawBody() param decorator, and NestJS will skip validating it.

@davidjgraph
davidjgraph / menustyle.js
Created September 12, 2013 20:09
mxGraph menu example
<!--
$Id: menustyle.html,v 1.5 2013/06/07 14:30:51 gaudenz Exp $
Copyright (c) 2006-2010, JGraph Ltd
Menustyle example for mxGraph. This example demonstrates using
CSS to style the mxPopupMenu.
-->
<html>
<head>
<title>Menustyle example for mxGraph</title>