mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
* [Fleet] Add validation test for openApi files * Fix missing types declaration * Fix licence issue Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Cristina Amico <criamico@users.noreply.github.com>
27 lines
858 B
TypeScript
27 lines
858 B
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
import SwaggerParser from '@apidevtools/swagger-parser';
|
|
|
|
// Validate the entrypoint.yaml file, sothe generated bundle will be correct.
|
|
// https://github.com/APIDevTools/swagger-parser
|
|
|
|
const validateDocs = async (entrypointFile: string) => {
|
|
try {
|
|
await SwaggerParser.validate(entrypointFile);
|
|
return 'Entrypoint is valid';
|
|
} catch (err) {
|
|
return err;
|
|
}
|
|
};
|
|
|
|
describe('openApi', () => {
|
|
it('Checks that entrypoint.yaml is valid', async () => {
|
|
expect(await validateDocs('x-pack/plugins/fleet/common/openapi/entrypoint.yaml')).toEqual(
|
|
'Entrypoint is valid'
|
|
);
|
|
});
|
|
});
|