@eropple/fastify-openapi3
Advanced tools
Comparing version 0.6.0-alpha to 0.6.0-alpha.1
{ | ||
"name": "@eropple/fastify-openapi3", | ||
"version": "0.6.0-alpha", | ||
"version": "0.6.0-alpha.1", | ||
"author": "Ed Ropple", | ||
@@ -5,0 +5,0 @@ "license": "LGPL-3.0", |
@@ -8,2 +8,3 @@ import '../src/extensions.js'; | ||
import { APPLICATION_JSON } from '../src/constants.js'; | ||
import { SchemaObject } from "openapi3-ts"; | ||
@@ -28,2 +29,8 @@ const pluginOpts: OAS3PluginOptions = { | ||
const ret = { | ||
bar: { | ||
foo: 'baz', | ||
}, | ||
}; | ||
await fastify.register(async (fastify: FastifyInstance) => { | ||
@@ -39,9 +46,3 @@ fastify.route<{ Reply: TestResponse }>({ | ||
oas: {}, | ||
handler: async (req, reply) => { | ||
return { | ||
bar: { | ||
foo: 'baz', | ||
}, | ||
}; | ||
} | ||
handler: () => ret, | ||
}); | ||
@@ -56,5 +57,16 @@ }); | ||
expect(oas.components?.schemas?.TestResponseInner).toBeTruthy(); | ||
expect((oas.components?.schemas?.TestResponse as SchemaObject)?.properties?.bar?.$ref) | ||
.toEqual('#/components/schemas/TestResponseInner'); | ||
expect(op?.responses?.['200']?.content?.[APPLICATION_JSON]?.schema) | ||
.toEqual({ $ref: '#/components/schemas/TestResponse' }); | ||
const response = await fastify.inject({ | ||
method: 'GET', | ||
url: '/nested', | ||
}); | ||
const responseBody = response.json(); | ||
expect(response.statusCode).toEqual(200); | ||
expect(responseBody).toMatchObject(ret); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
200376
2361