You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/techniques/versioning.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,6 +92,7 @@ The `key` property should be the key and separator of the key-value pair that co
92
92
> info **Hint** The `VersioningType` enum is available to use for the `type` property and is imported from the `@nestjs/common` package.
93
93
94
94
#### Custom Versioning Type
95
+
95
96
Custom Versioning uses any aspect of the request to specify the version (or versions). The incoming request is analyzed
96
97
using an `extractor` function that returns a string or array of strings.
97
98
@@ -101,14 +102,12 @@ lowest.
101
102
102
103
If an empty string or array is returned from the `extractor`, no routes are matched and a 404 is returned.
103
104
104
-
For example, if an incoming request specifies it supports versions `1`, `2`, and `3`, the `extractor`**MUST** return `[3,
105
-
2, 1]`. This ensures that the highest possible route version is selected first.
105
+
For example, if an incoming request specifies it supports versions `1`, `2`, and `3`, the `extractor`**MUST** return `[3, 2, 1]`. This ensures that the highest possible route version is selected first.
106
106
107
107
If versions `[3, 2, 1]` are extracted, but routes only exist for version `2` and `1`, the route that matches version `2`
108
108
is selected (version `3` is automatically ignored).
109
109
110
-
> warning **Notice** Selecting the highest matching version based on the array returned from `extractor`
111
-
> **does not reliably work** with the Express adapter due to design limitations. A single version (either a string or
110
+
> warning **Notice** Selecting the highest matching version based on the array returned from `extractor` > **does not reliably work** with the Express adapter due to design limitations. A single version (either a string or
112
111
> array of 1 element) works just fine in Express. Fastify correctly supports both highest matching version
0 commit comments