Skip to content

Commit 9f78301

Browse files
committed
bump version and update README
1 parent 902f2a0 commit 9f78301

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ const enforceSchema = require("fastify-enforce-schema");
1616

1717
const options = {
1818
required: ["response", "body", "params"], // available schemas that you'd want to enforce
19-
exclude: ["/api/v1/foo/:bar"], // optional, path names that you want to exclude
19+
exclude: [{ url: "/api/v1/foo/:bar", excludedSchemas: ["body"] }],
20+
// don't enforce body schema validation for a path /api/v1/foo/:bar
2021
};
2122

2223
fastify.register(enforceSchema, options);
@@ -27,4 +28,4 @@ fastify.register(enforceSchema, options);
2728
- **required**: response, body or params
2829
Note that the body schema will only be enforced on POST, PUT and PATCH HTTPS verbs
2930

30-
- **exclude**: Endpoints to exclude by the _routeOptions.path_
31+
- **exclude**: Endpoints to exclude by the _routeOptions.path_. Each exclude is an object, with a `url` and optional, `excludeSchemas` array. If the `excludeSchemas` array is not passed, validation for all 3 schemas (`body`, `respone`, `params`) is disabled.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "fastify-enforce-schema",
33
"url": "",
44
"author": "Aleksandar Grbic - (https://programmer.network)",
5-
"version": "1.0.3",
5+
"version": "1.0.4",
66
"description": "Enforce AJV schemas across your endpoints.",
77
"repository": {
88
"type": "git",

0 commit comments

Comments
 (0)