How to use the oas-resolver.resolve function in oas-resolver

To help you get started, we’ve selected a few oas-resolver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Mermade / oas-kit / packages / swagger2openapi / oas-resolve.js View on Github external
function main(str,source,options){
    let input = yaml.parse(str,{schema:'core'});
    resolver.resolve(input,source,options)
    .then(function(options){
        fs.writeFileSync(argv.output,yaml.stringify(options.openapi),'utf8');
    })
    .catch(function(err){
        console.warn(err);
    });
}
github Mermade / openapi-lint-vscode / extension.js View on Github external
let obj = {};
    try {
        obj = JSON.parse(text);
    }
    catch (ex) {
        try {
            obj = yaml.parse(text);
            yamlMode = true;
        }
        catch (ex) {
            vscode.window.showErrorMessage('Could not parse OpenAPI document as JSON or YAML');
            console.warn(ex.message);
            return;
        }
    }
    resolver.resolve(obj, editor.document.fileName, {})
    .then(function(options){
        if (yamlMode) {
            vscode.workspace.openTextDocument({ language: 'yaml', content: yaml.stringify(options.openapi) })
            .then(function(doc) {
                vscode.window.showTextDocument(doc);
            })
            .then(function(ex) {
                console.error(ex);
            });
        }
        else {
            vscode.workspace.openTextDocument({ language: 'json', content: JSON.stringify(options.openapi, null, 2)})
            .then(function(doc) {
                vscode.window.showTextDocument(doc);
            })
            .then(function(ex){

oas-resolver

Resolve external $refs in OpenAPI (swagger) 2.0 / 3.x definitions

BSD-3-Clause
Latest version published 3 years ago

Package Health Score

71 / 100
Full package analysis