@@ -12,14 +12,14 @@ a `content` field, it must enumerate all possible content types the
1212application expects to handle with the associated handler.
1313
1414All examples use the
15- [ JSON Schema Draft 7] ( https://json-schema.org/specification-links.html# draft-7 )
15+ [ JSON Schema Draft 7] ( https://json-schema.org/draft-07 )
1616specification.
1717
1818> ⚠ Warning:
1919> Treat schema definitions as application code. Validation and serialization
2020> features use ` new Function() ` , which is unsafe with user-provided schemas. See
21- > [ Ajv] ( https://npm.im /ajv ) and
22- > [ fast-json-stringify] ( https://npm.im /fast-json-stringify ) for details.
21+ > [ Ajv] ( https://www.npmjs.com/package /ajv ) and
22+ > [ fast-json-stringify] ( https://www.npmjs.com/package /fast-json-stringify ) for details.
2323>
2424> Whilst Fastify supports the
2525> [ ` $async ` Ajv feature] ( https://ajv.js.org/guide/async-validation.html ) ,
@@ -50,7 +50,7 @@ The `addSchema` API allows adding multiple schemas to the Fastify instance for
5050reuse throughout the application. This API is encapsulated.
5151
5252Shared schemas can be reused with the JSON Schema
53- [ ** ` $ref ` ** ] ( https://tools .ietf.org/html/draft-handrews-json-schema-01#section-8 )
53+ [ ** ` $ref ` ** ] ( https://datatracker .ietf.org/doc /html/draft-handrews-json-schema-01#section-8 )
5454keyword. Here is an overview of how references work:
5555
5656+ ` myField: { $ref: '#foo' } ` searches for ` $id: '#foo' ` in the current schema
@@ -579,13 +579,13 @@ fastify.post('/the/url', {
579579When implementing custom validators, follow these patterns to ensure compatibility
580580with all Fastify features:
581581
582- ** Always return objects, never throw:**
582+ ** Always return objects, never throw:**
583583` ` ` js
584584return { value: validatedData } // On success
585585return { error: validationError } // On failure
586586` ` `
587587
588- ** Use try-catch for safety:**
588+ ** Use try-catch for safety:**
589589` ` ` js
590590fastify.setValidatorCompiler(({ schema }) => {
591591 return (data) => {
@@ -907,7 +907,7 @@ fastify.setErrorHandler(function (error, request, reply) {
907907```
908908
909909For custom error responses in the schema, see
910- [`ajv-errors`](https://github.com/epoberezkin /ajv-errors). Check out the
910+ [`ajv-errors`](https://github.com/ajv-validator /ajv-errors). Check out the
911911[example](https://github.com/fastify/example/blob/HEAD/validation-messages/custom-errors-messages.js)
912912usage.
913913
@@ -969,7 +969,7 @@ fastify.post('/', { schema, }, (request, reply) => {
969969```
970970
971971To return localized error messages, see
972- [ajv-i18n](https://github.com/epoberezkin /ajv-i18n).
972+ [ajv-i18n](https://github.com/ajv-validator /ajv-i18n).
973973
974974```js
975975const localize = require(' ajv-i18n' )
@@ -1114,8 +1114,8 @@ const refToSharedSchemaDefinitions = {
11141114 Schema](https://json-schema.org/understanding-json-schema/about)
11151115- [fast-json-stringify
11161116 documentation](https://github.com/fastify/fast-json-stringify)
1117- - [Ajv documentation](https://github.com/epoberezkin /ajv/blob/master/README.md)
1118- - [Ajv i18n](https://github.com/epoberezkin /ajv-i18n)
1119- - [Ajv custom errors](https://github.com/epoberezkin /ajv-errors)
1117+ - [Ajv documentation](https://github.com/ajv-validator /ajv/blob/master/README.md)
1118+ - [Ajv i18n](https://github.com/ajv-validator /ajv-i18n)
1119+ - [Ajv custom errors](https://github.com/ajv-validator /ajv-errors)
11201120- Custom error handling with core methods with error file dumping
11211121 [example](https://github.com/fastify/example/tree/main/validation-messages)
0 commit comments