diff --git a/test/schema-feature.test.js b/test/schema-feature.test.js index 40a84c7b640..427385c6e2b 100644 --- a/test/schema-feature.test.js +++ b/test/schema-feature.test.js @@ -615,15 +615,15 @@ test('Get schema anyway should not add `properties` if allOf is present', t => { second: { type: 'number' } } }, - fastify.getSchema('first') + { $ref: 'first' } ] }) fastify.get('/', { handler: () => {}, schema: { - querystring: fastify.getSchema('second'), - response: { 200: fastify.getSchema('second') } + querystring: { $ref: 'second' }, + response: { 200: { $ref: 'second' } } } }) @@ -652,15 +652,15 @@ test('Get schema anyway should not add `properties` if oneOf is present', t => { second: { type: 'number' } } }, - fastify.getSchema('first') + { $ref: 'first' } ] }) fastify.get('/', { handler: () => {}, schema: { - querystring: fastify.getSchema('second'), - response: { 200: fastify.getSchema('second') } + querystring: { $ref: 'second' }, + response: { 200: { $ref: 'second' } } } }) @@ -689,15 +689,15 @@ test('Get schema anyway should not add `properties` if anyOf is present', t => { second: { type: 'number' } } }, - fastify.getSchema('first') + { $ref: 'first' } ] }) fastify.get('/', { handler: () => {}, schema: { - querystring: fastify.getSchema('second'), - response: { 200: fastify.getSchema('second') } + querystring: { $ref: 'second' }, + response: { 200: { $ref: 'second' } } } }) diff --git a/test/schema-special-usage.test.js b/test/schema-special-usage.test.js index d2cb65d56b5..f3e01b003f9 100644 --- a/test/schema-special-usage.test.js +++ b/test/schema-special-usage.test.js @@ -322,7 +322,7 @@ test("serializer read validator's schemas", t => { fastify.get('/', { schema: { response: { - '2xx': ajvInstance.getSchema('http://example.com/schemas/ref').schema + '2xx': { $ref: 'http://example.com/schemas/ref' } } }, handler (req, res) { res.send({ hello: 'world', evict: 'this' }) } @@ -364,9 +364,9 @@ test('setSchemaController in a plugin', t => { fastify.register(schemaPlugin) fastify.get('/', { schema: { - query: ajvInstance.getSchema('urn:schema:ref').schema, + query: { $ref: 'urn:schema:ref' }, response: { - '2xx': ajvInstance.getSchema('urn:schema:ref').schema + '2xx': { $ref: 'urn:schema:ref' } } }, handler (req, res) { @@ -534,9 +534,9 @@ test('setSchemaController in a plugin with head routes', t => { fastify.register(schemaPlugin) fastify.get('/', { schema: { - query: ajvInstance.getSchema('urn:schema:ref').schema, + query: { $ref: 'urn:schema:ref' }, response: { - '2xx': ajvInstance.getSchema('urn:schema:ref').schema + '2xx': { $ref: 'urn:schema:ref' } } }, handler (req, res) { @@ -614,9 +614,9 @@ test('multiple refs with the same ids', t => { fastify.head('/', { schema: { - query: refSchema, + query: { $ref: 'urn:schema:ref' }, response: { - '2xx': refSchema + '2xx': { $ref: 'urn:schema:ref' } } }, handler (req, res) { @@ -626,9 +626,9 @@ test('multiple refs with the same ids', t => { fastify.get('/', { schema: { - query: refSchema, + query: { $ref: 'urn:schema:ref' }, response: { - '2xx': refSchema + '2xx': { $ref: 'urn:schema:ref' } } }, handler (req, res) { diff --git a/test/schema-validation.test.js b/test/schema-validation.test.js index 2980e24a1eb..84519680971 100644 --- a/test/schema-validation.test.js +++ b/test/schema-validation.test.js @@ -125,7 +125,7 @@ test('External AJV instance', t => { schema: { body: schemaCRefToB, response: { - '2xx': ajv.getSchema('urn:schema:response').schema + '2xx': { $ref: 'urn:schema:response' } } } }) @@ -290,9 +290,9 @@ test('Triple $ref with a simple $id', t => { fastify.post('/', { handler (req, reply) { reply.send({ foo: 105, bar: 'foo' }) }, schema: { - body: ajv.getSchema('urn:schema:request').schema, + body: { $ref: 'urn:schema:request' }, response: { - '2xx': ajv.getSchema('urn:schema:response').schema + '2xx': { $ref: 'urn:schema:response' } } } })