本文整理汇总了TypeScript中yamljs.load函数的典型用法代码示例。如果您正苦于以下问题:TypeScript load函数的具体用法?TypeScript load怎么用?TypeScript load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: loadSwaggerDocument
private static loadSwaggerDocument(options: SwaggerOptions) {
let swaggerDocument: any;
if (_.endsWith(options.filePath, '.yml') || _.endsWith(options.filePath, '.yaml')) {
swaggerDocument = YAML.load(options.filePath);
}
else {
swaggerDocument = fs.readJSONSync(options.filePath);
}
return swaggerDocument;
}
开发者ID:thiagobustamante,项目名称:typescript-rest,代码行数:10,代码来源:server.ts
示例2: express
return new Promise<void>((resolve, reject) => {
const app: express.Application = express();
app.set('env', 'test');
swaggerFile = YAML.load('./test/data/swagger.yaml');
Server.swagger(app, {
endpoint: 'api-docs',
filePath: './test/data/swagger.yaml',
host: 'localhost:5674',
schemes: ['http']
});
server = app.listen(5674, (err: any) => {
if (err) {
return reject(err);
}
resolve();
});
});
开发者ID:thiagobustamante,项目名称:typescript-rest,代码行数:17,代码来源:swagger.spec.ts
示例3: loadConfiguration
export function loadConfiguration(
configFilePath: string,
cmdlineArgs: CliArgTypes
): Configuration {
let fileData: any = {}
if (configFilePath) {
debug(`loading configuration file: ${configFilePath}`)
fileData = YAML.load(configFilePath) || {}
}
debug(`configuration file data: ${JSON.stringify(this.fileData)}`)
function get(attributeName: string): string {
const camelized = camelCase(attributeName)
return (
cmdlineArgs[attributeName] ||
fileData[camelized] ||
defaultValues[camelized]
)
}
return {
FormatterClass: getFormatterClass(
get('format'),
defaultValues.FormatterClass
),
actions: fileData.actions ? fileData.actions : defaultValues.actions,
classPrefix: get('class-prefix'),
defaultFile: get('default-file'),
exclude: get('exclude'),
fileGlob: get('files') || defaultValues.fileGlob,
keepTmp: String(get('keep-tmp')) === 'true',
offline: String(get('offline')) === 'true',
publications:
Publications.fromJSON(fileData.publications || []).sorted() ||
defaultValues.publications,
sourceDir: get('source-dir'),
useSystemTempDirectory: String(get('use-system-temp-directory')) === 'true',
workspace: get('workspace') || ''
}
}
开发者ID:Originate,项目名称:tutorial-runner,代码行数:40,代码来源:load-configuration.ts
示例4: loadDocumentSync
export function loadDocumentSync(file: string): any {
return YAML.load(file);
}
开发者ID:carlansley,项目名称:swagger2,代码行数:3,代码来源:document.ts
示例5: function
interface Case {
name: string;
description: string;
input: string;
output: string;
errors: string[];
warnings?: string[];
infos?: string[];
sourceMap: number[];
}
declare global {
export var __dirname: string;
}
let cases: Case[] = YAML.load(require('path').join(__dirname, 'cases.yaml'));
describe('Parser', function() {
it('parses classes', function() {
let index = 0;
for (let testCase of cases) {
index++;
let parsed = parser.parse(testCase.input);
let cuVisitor = new CUVisitor(null);
let result = cuVisitor.visit(parsed);
expect(result).to.equal(testCase.output, `Test (${index}) - ${testCase.name}\n`);
if (testCase.warnings) {
expect(testCase.warnings.length).to.equal(Visitor.handler.warnings.length);
for (let warning of testCase.warnings) {
开发者ID:tomitrescak,项目名称:Transpiler,代码行数:31,代码来源:cu_visitor_test.ts
注:本文中的yamljs.load函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论