Skip to content

Commit a0649e9

Browse files
authored
docs: update syntax markdown, absolute paths and links (#6569)
* docs: update syntax markdown in validation and serialization section * fix: replace absolute paths with relative links in Decorators.md * fix: update links * fix: update links
1 parent d477915 commit a0649e9

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

docs/Reference/Decorators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ fastify.register(async function (fastify) {
401401
402402
> ℹ️ Note:
403403
> For TypeScript users, `getDecorator` supports generic type parameters.
404-
> See the [TypeScript documentation](/docs/Reference/TypeScript.md) for
404+
> See the [TypeScript documentation](./TypeScript.md) for
405405
> advanced typing examples.
406406
407407
#### `setDecorator(name, value)`
@@ -432,5 +432,5 @@ fastify.addHook('preHandler', async (req, reply) => {
432432
433433
> ℹ️ Note:
434434
> For TypeScript users, see the
435-
> [TypeScript documentation](/docs/Reference/TypeScript.md) for advanced
435+
> [TypeScript documentation](./TypeScript.md) for advanced
436436
> typing examples using `setDecorator<T>`.

docs/Reference/Validation-and-Serialization.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ a `content` field, it must enumerate all possible content types the
1212
application expects to handle with the associated handler.
1313

1414
All 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)
1616
specification.
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
5050
reuse throughout the application. This API is encapsulated.
5151

5252
Shared 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)
5454
keyword. 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', {
579579
When implementing custom validators, follow these patterns to ensure compatibility
580580
with all Fastify features:
581581
582-
** Always return objects, never throw:**
582+
**Always return objects, never throw:**
583583
```js
584584
return { value: validatedData } // On success
585585
return { error: validationError } // On failure
586586
```
587587
588-
** Use try-catch for safety:**
588+
**Use try-catch for safety:**
589589
```js
590590
fastify.setValidatorCompiler(({ schema }) => {
591591
return (data) => {
@@ -907,7 +907,7 @@ fastify.setErrorHandler(function (error, request, reply) {
907907
```
908908
909909
For 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)
912912
usage.
913913
@@ -969,7 +969,7 @@ fastify.post('/', { schema, }, (request, reply) => {
969969
```
970970
971971
To 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
975975
const 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

Comments
 (0)