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.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// exporting from a bs58 private key to an Uint8Array | |
// == from phantom private key to solana cli id.json key file | |
// npm install bs58 @solana/web3.js | |
const web3 = require("@solana/web3.js"); | |
const bs58 = require('bs58'); | |
let secretKey = bs58.decode("[base58 private key here]"); | |
console.log(`[${web3.Keypair.fromSecretKey(secretKey).secretKey}]`); | |
// exporting back from Uint8Array to bs58 private key |