Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const yamlDocument = readFileSync(join(__dirname, './assets/openapi.hooks.yml'), 'utf8');
const expectedDocument = parse(yamlDocument);
const actualDocument = createOpenApiDocument(ApiController);
deepStrictEqual(actualDocument, expectedDocument);
// Test hook conflicts (Two calls of @JWT).
@ApiInfo({
title: 'My API',
version: '1.0.0'
})
class ApiController2 {
@Get('/products')
@JWTOptional()
readProducts() {}
@Post('/products')
@JWTRequired()
@ValidateBody({
properties: {
name: { type: 'string' }
},
type: 'object',
})
createProduct() {}
}
const yamlDocument2 = readFileSync(join(__dirname, './assets/openapi.hooks2.yml'), 'utf8');
const expectedDocument2 = parse(yamlDocument2);