|
4 | 4 | [](https://github.com/fastify/fastify-swagger/actions/workflows/ci.yml) |
5 | 5 | [](https://github.com/neostandard/neostandard) |
6 | 6 |
|
7 | | -A Fastify plugin for serving [Swagger (OpenAPI v2)](https://swagger.io/specification/v2/) or [OpenAPI v3](https://swagger.io/specification) schemas, which are automatically generated from your route schemas, or an existing Swagger/OpenAPI schema. |
| 7 | +A Fastify plugin for serving [Swagger (OpenAPI v2)](https://swagger.io/specification/v2/) or [OpenAPI v3](https://swagger.io/specification/) schemas, which are automatically generated from your route schemas, or an existing Swagger/OpenAPI schema. |
8 | 8 |
|
9 | 9 | If you are looking for a plugin to generate routes from an existing OpenAPI schema, check out [fastify-openapi-glue](https://github.com/seriousme/fastify-openapi-glue). |
10 | 10 |
|
@@ -337,7 +337,7 @@ await fastify.register(require('@fastify/swagger'), { |
337 | 337 | In `dynamic` mode, this plugin resolves all `$ref`s in the application's schemas, creating a new in-line schema that references itself. |
338 | 338 | This ensures the generated documentation is valid, preventing Swagger UI from failing to fetch schemas from the server or network. |
339 | 339 |
|
340 | | -By default, this option resolves all `$ref`s, renaming them to `def-${counter}`, while view models keep the original `$id` naming using the [`title` parameter](https://swagger.io/docs/specification/2-0/basic-structure/#metadata). |
| 340 | +By default, this option resolves all `$ref`s, renaming them to `def-${counter}`, while view models keep the original `$id` naming using the [`title` parameter](https://swagger.io/docs/specification/v2_0/basic-structure/#metadata). |
341 | 341 |
|
342 | 342 | This logic can be customized by passing a `refResolver` option to the plugin: |
343 | 343 |
|
@@ -574,7 +574,7 @@ Specify the `type` property when decorating response headers to prevent schema m |
574 | 574 |
|
575 | 575 | <a name="route.response.empty_body"></a> |
576 | 576 | ##### Different content types responses |
577 | | -> ℹ️ Note: Supported [only by OpenAPI v3](https://swagger.io/docs/specification/describing-responses/), not Swagger (OpenAPI v2). |
| 577 | +> ℹ️ Note: Supported [only by OpenAPI v3](https://swagger.io/docs/specification/v3_0/describing-responses/), not Swagger (OpenAPI v2). |
578 | 578 |
|
579 | 579 | Different content types are supported by `@fastify/swagger` and `@fastify`. |
580 | 580 | Use `content` for the response to prevent Fastify from failing to compile the schema: |
@@ -627,14 +627,14 @@ Specify `type: 'null'` for the response to prevent Fastify from failing to compi |
627 | 627 |
|
628 | 628 | > ℹ️ Note: OpenAPI's terminology differs from Fastify's. OpenAPI uses "parameter" to refer to parts of a request that in [Fastify's validation documentation](https://fastify.dev/docs/latest/Reference/Validation-and-Serialization/) are called "querystring", "params", and "headers". |
629 | 629 |
|
630 | | -OpenAPI extends the [JSON schema specification](https://json-schema.org/specification.html) with options like `collectionFormat` for encoding array parameters. |
| 630 | +OpenAPI extends the [JSON schema specification](https://json-schema.org/specification) with options like `collectionFormat` for encoding array parameters. |
631 | 631 |
|
632 | 632 | These encoding options only affect how Swagger UI presents documentation and generates `curl` commands. |
633 | 633 | Depending on the schema options, you may need to change Fastify's default query string parser to produce a JavaScript object conforming to the schema. |
634 | 634 | The default parser conforms to `collectionFormat: "multi"`. |
635 | 635 | For `collectionFormat: "csv"`, replace the default parser with one that parses CSV values into arrays. This applies to other request parts that OpenAPI calls "parameters" and are not encoded as JSON. |
636 | 636 |
|
637 | | -Different serialization `style` and `explode` can also be applied as specified [here](https://swagger.io/docs/specification/serialization/#query). |
| 637 | +Different serialization `style` and `explode` can also be applied as specified [here](https://swagger.io/docs/specification/v3_0/serialization/#query). |
638 | 638 |
|
639 | 639 | `@fastify/swagger` supports these options as shown in this example: |
640 | 640 |
|
@@ -689,7 +689,7 @@ There is a complete runnable example [here](examples/collection-format.js). |
689 | 689 | <a name="route.complex-serialization"></a> |
690 | 690 | #### Complex serialization in query and cookie, eg. JSON |
691 | 691 |
|
692 | | -> ℹ️ Note: Supported [only by OpenAPI v3](https://swagger.io/docs/specification/describing-parameters/#schema-vs-content), not Swagger (OpenAPI v2). |
| 692 | +> ℹ️ Note: Supported [only by OpenAPI v3](https://swagger.io/docs/specification/v3_0/describing-parameters/#schema-vs-content), not Swagger (OpenAPI v2). |
693 | 693 |
|
694 | 694 | ``` |
695 | 695 | http://localhost/?filter={"foo":"baz","bar":"qux"} |
@@ -904,7 +904,7 @@ Generates this in the OpenAPI v3 schema's `paths`: |
904 | 904 | <a name="route.links"></a> |
905 | 905 | #### Links |
906 | 906 |
|
907 | | -> ℹ️ Note: Supported [only by OpenAPI v3](https://swagger.io/docs/specification/links), not Swagger (OpenAPI v2). |
| 907 | +> ℹ️ Note: Supported [only by OpenAPI v3](https://swagger.io/docs/specification/v3_0/links/), not Swagger (OpenAPI v2). |
908 | 908 |
|
909 | 909 | Add OpenAPI v3 Links by adding a `links` property to the top-level options of a route. See: |
910 | 910 |
|
@@ -1006,7 +1006,7 @@ This plugin can be integrated with `@fastify/helmet` with minimal effort: |
1006 | 1006 | <a name="schema.examplesField"></a> |
1007 | 1007 | ### Add examples to the schema |
1008 | 1008 |
|
1009 | | -[OpenAPI](https://swagger.io/specification/#example-object) and [JSON Schema](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.5) have different examples field formats. |
| 1009 | +[OpenAPI](https://swagger.io/specification/#example-object) and [JSON Schema](https://json-schema.org/draft/2020-12/json-schema-validation) have different examples field formats. |
1010 | 1010 |
|
1011 | 1011 | Array with examples from JSON Schema converted to OpenAPI `example` or `examples` field automatically with generated names (example1, example2...): |
1012 | 1012 |
|
@@ -1148,7 +1148,9 @@ The `/docs/json` endpoint in dynamic mode produces a single `swagger.json` file, |
1148 | 1148 |
|
1149 | 1149 | This project is kindly sponsored by: |
1150 | 1150 | - [nearForm](https://nearform.com) |
1151 | | -- [LetzDoIt](https://www.letzdoitapp.com/) |
| 1151 | +
|
| 1152 | +Past sponsors: |
| 1153 | +- LetzDoIt |
1152 | 1154 |
|
1153 | 1155 | <a name="license"></a> |
1154 | 1156 | ## License |
|
0 commit comments