This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from raml-org/develop
Migrate to webapi-parser to convert
- Loading branch information
Showing
54 changed files
with
2,877 additions
and
5,090 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
'use strict' | ||
|
||
var r2j = require('ramldt2jsonschema') | ||
var join = require('path').join | ||
var fs = require('fs') | ||
const r2j = require('ramldt2jsonschema') | ||
const join = require('path').join | ||
const fs = require('fs') | ||
|
||
var filePath = join(__dirname, '../test/integration/raml/complex_cat.raml') | ||
var ramlData = fs.readFileSync(filePath).toString() | ||
const filePath = join(__dirname, '../test/integration/raml/complex_cat.raml') | ||
const ramlData = fs.readFileSync(filePath).toString() | ||
|
||
r2j.dt2js(ramlData, 'Cat', function (err, schema) { | ||
if (err) { | ||
async function main () { | ||
let schema | ||
try { | ||
schema = await r2j.dt2js(ramlData, 'Cat') | ||
} catch (err) { | ||
console.log(err) | ||
return | ||
} | ||
console.log(JSON.stringify(schema, null, 2)) | ||
}) | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
'use strict' | ||
|
||
var r2j = require('ramldt2jsonschema') | ||
var join = require('path').join | ||
var fs = require('fs') | ||
const r2j = require('ramldt2jsonschema') | ||
const join = require('path').join | ||
const fs = require('fs') | ||
const yaml = require('js-yaml') | ||
|
||
var filePath = join(__dirname, '../test/integration/json/complex_cat.json') | ||
var jsonData = fs.readFileSync(filePath).toString() | ||
const filePath = join(__dirname, '../test/integration/json/complex_cat.json') | ||
const jsonData = fs.readFileSync(filePath).toString() | ||
|
||
r2j.js2dt(jsonData, 'Person', function (err, raml) { | ||
if (err) { | ||
async function main () { | ||
let raml | ||
try { | ||
raml = await r2j.js2dt(jsonData, 'Cat') | ||
} catch (err) { | ||
console.log(err) | ||
return | ||
} | ||
console.log('#%RAML 1.0 Library\n') | ||
console.log(raml) | ||
}) | ||
console.log(yaml.safeDump(raml, { noRefs: true })) | ||
} | ||
|
||
main() |
Oops, something went wrong.