Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Swagger CLI Issue #19

node v8.17.0
version: 1.0.0
endpointsharetweet
var swaggerParser = require("swagger-parser") var fs = require('fs') fs.writeFileSync('index.yaml', ` swagger: '2.0' info: version: "1.0.0" title: "Test" paths: /apiversion: get: responses: 200: description: Successful response schema: $ref: '#/definitions/ApiVersionInfo' $ref: 'separate.yaml#/paths' definitions: ApiVersionInfo: type: object properties: apiVersion: type: string `) fs.writeFileSync('separate.yaml', ` paths: /test: get: responses: 200: description: Successful response schema: $ref: '#/definitions/TestEndpointGet' definitions: TestEndpointGet: type: object properties: test: type: integer `) try { let bundled = await swaggerParser.bundle('index.yaml') console.log('Successfully bundled\n\n' + JSON.stringify(bundled, null, 2)) } catch (error) { console.error('Error while bundling', error) } try { let dereferenced = await swaggerParser.dereference('index.yaml') console.log('Successfully dereferenced\n\n' + JSON.stringify(dereferenced, null, 2)) } catch (error) { console.error('Error while dereferencing', error) }
Loading…

no comments

    sign in to comment