2017-04-16 08:59:25 +03:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
|
2018-06-04 23:06:00 +03:00
|
|
|
// Sample standalone script to call live validator.
|
2020-11-24 06:07:36 +03:00
|
|
|
import { LiveValidator } from "../lib/liveValidation/liveValidator";
|
2018-05-30 01:38:27 +03:00
|
|
|
|
2018-06-04 23:06:00 +03:00
|
|
|
const options = {
|
2019-04-01 20:59:25 +03:00
|
|
|
directory: `${__dirname}/../../test/liveValidation/swaggers/`,
|
2019-12-05 12:43:14 +03:00
|
|
|
swaggerPathsPattern: [
|
2020-11-24 06:07:36 +03:00
|
|
|
"specification\\mediaservices\\resource-manager\\Microsoft.Media\\2018-07-01\\*.json",
|
2019-12-05 12:43:14 +03:00
|
|
|
],
|
2019-03-28 21:47:48 +03:00
|
|
|
git: {
|
2020-11-24 06:07:36 +03:00
|
|
|
shouldClone: false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
const validator = new LiveValidator(options);
|
2018-06-30 01:30:59 +03:00
|
|
|
|
2020-11-24 06:07:36 +03:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
2019-03-28 21:47:48 +03:00
|
|
|
validator.initialize().then(() => {
|
2020-11-24 06:07:36 +03:00
|
|
|
const reqRes = require(`${__dirname}/../../test/liveValidation/payloads/oneOfMissing_input.json`);
|
|
|
|
const result = validator.validateLiveRequestResponse(reqRes);
|
2019-03-28 21:47:48 +03:00
|
|
|
// tslint:disable-next-line:no-console
|
2020-11-24 06:07:36 +03:00
|
|
|
console.log(`${result}`);
|
|
|
|
});
|