Skip to content

Commit 10f7851

Browse files
jsumnersgiovanniruzziGiovanni Ruzziclimba03003
authored
Merge next into master (#805)
* Updates for Fastify v5 (#788) * chore: update fastify workflow version * chore: update dependencies * chore: update dependencies * chore: update test and snapshots --------- Co-authored-by: Giovanni Ruzzi <[email protected]> * Updates for Fastify v5 (#788) * chore: update fastify workflow version * chore: update dependencies * chore: update dependencies * chore: update test and snapshots --------- Co-authored-by: Giovanni Ruzzi <[email protected]> * update fastify deps * update fastify deps * Updates for Fastify v5 (#788) * chore: update fastify workflow version * chore: update dependencies * chore: update dependencies * chore: update test and snapshots --------- Co-authored-by: Giovanni Ruzzi <[email protected]> * Update .github/workflows/ci.yml Co-authored-by: KaKa <[email protected]> Signed-off-by: James Sumners <[email protected]> --------- Signed-off-by: James Sumners <[email protected]> Co-authored-by: Giovanni Ruzzi <[email protected]> Co-authored-by: Giovanni Ruzzi <[email protected]> Co-authored-by: KaKa <[email protected]>
1 parent f8591cd commit 10f7851

File tree

9 files changed

+45
-55
lines changed

9 files changed

+45
-55
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717

1818
jobs:
1919
test:
20-
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
20+
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5.0.0
2121
with:
2222
license-check: true
2323
lint: true

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,24 @@
4040
"homepage": "https://github.com/fastify/fastify-swagger#readme",
4141
"devDependencies": {
4242
"@apidevtools/swagger-parser": "^10.1.0",
43-
"@fastify/cookie": "^9.0.4",
44-
"@fastify/pre-commit": "^2.0.2",
45-
"@types/node": "^20.1.0",
46-
"fastify": "^4.0.0",
43+
"@fastify/cookie": "^10.0.0-pre.fv5.1",
44+
"@fastify/pre-commit": "^2.1.0",
45+
"@types/node": "^20.12.8",
46+
"fastify": "^5.0.0-alpha.3",
4747
"fluent-json-schema": "^5.0.0",
48-
"joi": "^17.6.0",
49-
"joi-to-json": "^4.0.0",
50-
"qs": "^6.10.3",
51-
"standard": "^17.0.0",
52-
"tap": "^16.2.0",
48+
"joi": "^17.13.1",
49+
"joi-to-json": "^4.2.1",
50+
"qs": "^6.12.1",
51+
"standard": "^17.1.0",
52+
"tap": "18.7.2",
5353
"tsd": "^0.31.0"
5454
},
5555
"dependencies": {
56-
"fastify-plugin": "^4.0.0",
56+
"fastify-plugin": "^5.0.0-pre.fv5.1",
5757
"json-schema-resolver": "^2.0.0",
58-
"openapi-types": "^12.0.0",
59-
"rfdc": "^1.3.0",
60-
"yaml": "^2.2.2"
58+
"openapi-types": "^12.1.3",
59+
"rfdc": "^1.3.1",
60+
"yaml": "^2.4.2"
6161
},
6262
"standard": {
6363
"ignore": [

tap-snapshots/test/mode/static.js.test.cjs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Make sure to inspect the output below. Do not ignore changes!
66
*/
77
'use strict'
8-
exports[`test/mode/static.js TAP postProcessor works, swagger route returns updated yaml > must match snapshot 1`] = `
8+
exports[`test/mode/static.js > TAP > postProcessor works, swagger route returns updated yaml > must match snapshot 1`] = `
99
openapi: 3.0.0
1010
info:
1111
description: Test swagger specification
@@ -40,36 +40,26 @@ paths:
4040
4141
`
4242

43-
exports[`test/mode/static.js TAP specification validation check works > must match snapshot 1`] = `
43+
exports[`test/mode/static.js > TAP > specification validation check works > must match snapshot 1`] = `
4444
Error: specification is missing in the module options
4545
`
4646

47-
exports[`test/mode/static.js TAP specification validation check works > must match snapshot 2`] = `
47+
exports[`test/mode/static.js > TAP > specification validation check works > must match snapshot 2`] = `
4848
Error: specification is not an object
4949
`
5050

51-
exports[`test/mode/static.js TAP specification validation check works > must match snapshot 3`] = `
51+
exports[`test/mode/static.js > TAP > specification validation check works > must match snapshot 3`] = `
5252
Error: both specification.path and specification.document are missing, should be path to the file or swagger document spec
5353
`
5454

55-
exports[`test/mode/static.js TAP specification validation check works > must match snapshot 4`] = `
55+
exports[`test/mode/static.js > TAP > specification validation check works > must match snapshot 4`] = `
5656
Error: specification.path is not a string
5757
`
5858

59-
exports[`test/mode/static.js TAP specification validation check works > must match snapshot 5`] = `
59+
exports[`test/mode/static.js > TAP > specification validation check works > must match snapshot 5`] = `
6060
Error: /hello/lionel.richie does not exist
6161
`
6262

63-
exports[`test/mode/static.js TAP specification validation check works > must match snapshot 6`] = `
63+
exports[`test/mode/static.js > TAP > specification validation check works > must match snapshot 6`] = `
6464
Error: specification.postProcessor should be a function
6565
`
66-
67-
exports[`test/mode/static.js TAP swagger route returns explicitly passed doc > must match snapshot 1`] = `
68-
{
69-
"info": {
70-
"title": "Test swagger",
71-
"description": "testing the fastify swagger api",
72-
"version": "0.1.0"
73-
}
74-
}
75-
`

test/mode/static.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ test('non-object specification.document throws an error', async (t) => {
185185
t.plan(1)
186186
const fastify = new Fastify()
187187

188-
t.rejects(fastify.register(fastifySwagger, config), new Error('specification.document is not an object'))
188+
t.rejects(async () => await fastify.register(fastifySwagger, config), new Error('specification.document is not an object'))
189189
})
190190

191191
test('object specification.document', async (t) => {

test/spec/openapi/option.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ test('openapi components', async (t) => {
107107
await fastify.ready()
108108

109109
const openapiObject = fastify.swagger()
110-
t.same(openapiObject.components.schemas, openapiOption.openapi.components.schemas)
110+
t.match(openapiObject.components.schemas, openapiOption.openapi.components.schemas)
111111
delete openapiOption.openapi.components.schemas // remove what we just added
112112
})
113113

test/spec/openapi/route.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ test('route options - produces', async (t) => {
159159
const api = await Swagger.validate(openapiObject)
160160
const definedPath = api.paths['/'].get
161161
t.ok(definedPath)
162-
t.same(definedPath.responses[200].content, {
162+
t.match(definedPath.responses[200].content, {
163163
'*/*': {
164164
schema: {
165165
type: 'object',
@@ -234,7 +234,7 @@ test('parses form parameters when all api consumes application/x-www-form-urlenc
234234
const api = await Swagger.validate(openapiObject)
235235
const definedPath = api.paths['/'].post
236236
t.ok(definedPath)
237-
t.same(definedPath.requestBody.content, {
237+
t.match(definedPath.requestBody.content, {
238238
'application/x-www-form-urlencoded': {
239239
schema: {
240240
type: 'object',
@@ -423,7 +423,7 @@ test('cookie and query with serialization type', async (t) => {
423423

424424
const cookiesPath = api.paths['/'].get
425425
t.ok(cookiesPath)
426-
t.same(cookiesPath.parameters, [
426+
t.match(cookiesPath.parameters, [
427427
{
428428
required: false,
429429
in: 'cookie',
@@ -445,7 +445,7 @@ test('cookie and query with serialization type', async (t) => {
445445

446446
const querystringPath = api.paths['/example'].get
447447
t.ok(querystringPath)
448-
t.same(querystringPath.parameters, [
448+
t.match(querystringPath.parameters, [
449449
{
450450
required: false,
451451
in: 'query',

test/spec/openapi/schema.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ test('support multiple content types as response', async t => {
156156
const api = await Swagger.validate(swaggerObject)
157157
const definedPath = api.paths['/'].get
158158
t.same(definedPath.responses['200'].description, 'Description and all status-code based properties are working')
159-
t.strictSame(definedPath.responses['200'].content, {
159+
t.match(definedPath.responses['200'].content, {
160160
'application/json': {
161161
schema: {
162162
type: 'object',
@@ -175,7 +175,7 @@ test('support multiple content types as response', async t => {
175175
}
176176
})
177177
t.same(definedPath.responses['4XX'].description, 'Default Response')
178-
t.strictSame(definedPath.responses['4XX'].content, {
178+
t.match(definedPath.responses['4XX'].content, {
179179
'application/json': {
180180
schema: {
181181
type: 'object',
@@ -185,7 +185,7 @@ test('support multiple content types as response', async t => {
185185
}
186186
}
187187
})
188-
t.strictSame(definedPath.responses[300].content, {
188+
t.match(definedPath.responses[300].content, {
189189
'application/json': {
190190
schema: {
191191
type: 'object',
@@ -486,7 +486,7 @@ test('support "default" parameter', async t => {
486486

487487
const definedPath = api.paths['/'].get
488488

489-
t.same(definedPath.responses.default, {
489+
t.match(definedPath.responses.default, {
490490
description: 'Default Response',
491491
content: {
492492
'application/json': {
@@ -564,7 +564,7 @@ test('support "patternProperties" parameter', async t => {
564564

565565
const definedPath = api.paths['/'].get
566566

567-
t.same(definedPath.responses[200], {
567+
t.match(definedPath.responses[200], {
568568
description: 'Expected Response',
569569
content: {
570570
'application/json': {
@@ -622,7 +622,7 @@ test('properly support "patternProperties" parameter', async t => {
622622

623623
const definedPath = api.paths['/'].get
624624

625-
t.same(definedPath.responses[200], {
625+
t.match(definedPath.responses[200], {
626626
description: 'Expected Response',
627627
content: {
628628
'application/json': {
@@ -678,7 +678,7 @@ test('support "const" keyword', async t => {
678678
const api = await Swagger.validate(swaggerObject)
679679

680680
const definedPath = api.paths['/'].post
681-
t.same(definedPath.requestBody, {
681+
t.match(definedPath.requestBody, {
682682
content: {
683683
'application/json': {
684684
schema: {
@@ -740,7 +740,7 @@ test('support object properties named "const"', async t => {
740740
const api = await Swagger.validate(swaggerObject)
741741

742742
const definedPath = api.paths['/'].post
743-
t.same(definedPath.requestBody, {
743+
t.match(definedPath.requestBody, {
744744
content: {
745745
'application/json': {
746746
schema: {
@@ -799,7 +799,7 @@ test('support object properties with special names', async t => {
799799
const api = await Swagger.validate(swaggerObject)
800800

801801
const definedPath = api.paths['/'].post
802-
t.same(definedPath.requestBody, {
802+
t.match(definedPath.requestBody, {
803803
content: {
804804
'application/json': {
805805
schema: {
@@ -853,7 +853,7 @@ test('support "description" keyword', async t => {
853853
const api = await Swagger.validate(swaggerObject)
854854

855855
const definedPath = api.paths['/'].post
856-
t.same(definedPath.requestBody, {
856+
t.match(definedPath.requestBody, {
857857
description: 'Body description',
858858
content: {
859859
'application/json': {

test/spec/swagger/option.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ test('swagger definitions', async (t) => {
9595
await fastify.ready()
9696

9797
const swaggerObject = fastify.swagger()
98-
t.same(swaggerObject.definitions, swaggerOption.swagger.definitions)
98+
t.match(swaggerObject.definitions, swaggerOption.swagger.definitions)
9999
delete swaggerOption.swagger.definitions // remove what we just added
100100
})
101101

test/spec/swagger/schema.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ test('support "default" parameter', async t => {
343343

344344
const definedPath = api.paths['/'].get
345345

346-
t.same(definedPath.responses.default, {
346+
t.match(definedPath.responses.default, {
347347
description: 'Default Response',
348348
schema: {
349349
description: 'Default Response',
@@ -421,12 +421,12 @@ test('support "patternProperties" in json schema', async t => {
421421

422422
const definedPath = api.paths['/'].post
423423

424-
t.same(definedPath.parameters[0].schema, {
424+
t.match(definedPath.parameters[0].schema, {
425425
type: 'object',
426426
additionalProperties: { type: 'string' }
427427
})
428428

429-
t.same(definedPath.responses[200], {
429+
t.match(definedPath.responses[200], {
430430
description: 'Expected Response',
431431
schema: {
432432
description: 'Expected Response',
@@ -471,7 +471,7 @@ test('support "const" keyword', async t => {
471471
const api = await Swagger.validate(swaggerObject)
472472

473473
const definedPath = api.paths['/'].post
474-
t.same(definedPath.parameters[0].schema, {
474+
t.match(definedPath.parameters[0].schema, {
475475
type: 'object',
476476
properties: {
477477
obj: {
@@ -523,7 +523,7 @@ test('support "description" keyword', async t => {
523523

524524
const definedPath = api.paths['/'].post
525525
t.same(definedPath.parameters[0].description, 'Body description')
526-
t.same(definedPath.parameters[0].schema, {
526+
t.match(definedPath.parameters[0].schema, {
527527
type: 'object',
528528
description: 'Body description',
529529
properties: {
@@ -696,7 +696,7 @@ test('add default properties for url params when missing schema.params', async t
696696

697697
const definedPath = api.paths['/{userId}'].post
698698

699-
t.strictSame(definedPath.parameters[0].schema, {
699+
t.match(definedPath.parameters[0].schema, {
700700
type: 'object',
701701
properties: {
702702
bio: {
@@ -743,7 +743,7 @@ test('avoid overwriting params when schema.params is provided', async t => {
743743

744744
const definedPath = swaggerObject.paths['/{userId}'].post
745745

746-
t.strictSame(definedPath.parameters[0].schema, {
746+
t.match(definedPath.parameters[0].schema, {
747747
type: 'object',
748748
properties: {
749749
bio: {

0 commit comments

Comments
 (0)