Skip to content
Add additionalProperties: false by default to your JSON Schemas
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.editorconfig
.eslintrc.json
.gitignore
.travis.yml
LICENSE
README.md
index.js
package-lock.json
package.json

README.md

fastify-no-additional-properties

npm version Dependencies Status Build Status Coverage Status JavaScript Style Guide

Add additionalProperties: false by default to your JSON Schemas.

Install

npm install --save fastify-no-additional-properties

Usage

Register this plugin and you are done!

const fastify = require('fastify')()

// Default options
fastify.register(require('fastify-no-additional-properties'), {
  // Enable this plugin for body schema
  body: true,
  // Enable this plugin for request headers schema
  headers: false,
  // Enable this plugin for URL parameters schema
  params: false,
  // Enable this plugin for query string schema
  query: true
})

// Register web routes here...

fastify.listen(3000, err => {
  if (err) throw err
})
You can’t perform that action at this time.