本文整理汇总了TypeScript中@azure/rest-api-specs-scripts.utils类的典型用法代码示例。如果您正苦于以下问题:TypeScript utils类的具体用法?TypeScript utils怎么用?TypeScript utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了utils类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: before
before(function (done) {
utils.initializeValidator().then((result: Context) => {
syntaxContext = result;
done();
});
});
示例2: it
it('x-ms-examples: ' + example + ' should be a valid x-ms-example.', function (done) {
utils.parseJsonFromFile(example).then((parsedData: unknown) => {
var valid = syntaxContext.validator.validate(parsedData, syntaxContext.exampleSchema);
if (!valid) {
var error = syntaxContext.validator.getLastErrors();
throw new Error("Schema validation failed: " + util.inspect(error, { depth: null }));
}
assert(valid === true);
done();
});
});
示例3: describe
describe('External file or url references ("$ref") in a swagger spec:', function () {
for (const swagger of utils.getSwaggers()) {
it(swagger + ' should be completely resolvable.', function (done) {
RefParser.bundle(swagger, function (bundleErr: { readonly message: unknown }, _bundleResult: unknown) {
if (bundleErr) {
var msg = swagger + ' has references that cannot be resolved. They are as follows: \n' + util.inspect(bundleErr.message, { depth: null });
console.log(msg);
throw new Error(msg);
}
done();
});
});
}
});