{"id":49052,"library":"ramldt2jsonschema","title":"ramldt2jsonschema","description":"CLI and library to convert RAML 1.0 data types to JSON Schema Draft 4/6/7 and back. Stable version 1.2.3, maintained by the RAML organization. Uses webapi-parser under the hood. Key differentiators: bidirectional conversion (dt2js and js2dt), supports external references via basePath, and validation options. As of v1.2.3, there have been no recent releases; the package is in maintenance mode with known limitations (e.g., unsupported JSON Schema properties like allOf, oneOf) and issues (array items not properly converted).","status":"maintenance","version":"1.2.3","language":"javascript","source_language":"en","source_url":"git://github.com/raml-org/ramldt2jsonschema","tags":["javascript","raml","json","types"],"install":[{"cmd":"npm install ramldt2jsonschema","lang":"bash","label":"npm"},{"cmd":"yarn add ramldt2jsonschema","lang":"bash","label":"yarn"},{"cmd":"pnpm add ramldt2jsonschema","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"core parsing dependency","package":"webapi-parser","optional":false},{"reason":"used in js2dt example for YAML output","package":"js-yaml","optional":false},{"reason":"optional validation for JSON Schema output","package":"ajv","optional":true}],"imports":[{"note":"ESM import is identical to CJS destructure; package does not export default.","wrong":"const dt2js = require('ramldt2jsonschema').dt2js","symbol":"dt2js","correct":"import { dt2js } from 'ramldt2jsonschema'"},{"note":"Both ESM and CJS work; be careful to destructure correctly.","wrong":"const { js2dt } = require('ramldt2jsonschema')","symbol":"js2dt","correct":"import { js2dt } from 'ramldt2jsonschema'"},{"note":"No default export; use namespace import.","wrong":"import r2j from 'ramldt2jsonschema'","symbol":"default import","correct":"import * as r2j from 'ramldt2jsonschema'"}],"quickstart":{"code":"const { dt2js } = require('ramldt2jsonschema');\nconst path = require('path');\nconst fs = require('fs');\n\nasync function main() {\n  const ramlData = fs.readFileSync(path.join(__dirname, 'types.raml'), 'utf-8');\n  try {\n    const schema = await dt2js(ramlData, 'MyType');\n    console.log(JSON.stringify(schema, null, 2));\n  } catch (err) {\n    console.error(err);\n  }\n}\nmain();","lang":"javascript","description":"Converts a RAML data type named 'MyType' from a file 'types.raml' to JSON Schema using the library."},"warnings":[{"fix":"Ensure RAML files are valid per RAML 1.0 spec; check webapi-parser issues for known limitations.","message":"The package uses webapi-parser which may break on certain RAML constructs.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Manually handle unsupported properties; consider using alternative tools for complex schemas.","message":"js2dt has known limitations: unsupported JSON Schema properties (allOf, oneOf, not, etc.) may produce incorrect conversions.","severity":"deprecated","affected_versions":"1.2.3"},{"fix":"Always pass { basePath: ... } as third argument when using !include or $ref.","message":"basePath argument must be provided when external references are used; otherwise files will not be resolved.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Avoid using tuple arrays in JSON Schema if converting to RAML; stay updated on fixes.","message":"Array items property not properly converted when items is an array (tuple typing) in js2dt (see issue #111).","severity":"gotcha","affected_versions":"<=1.2.3"},{"fix":"Check for newer versions; consider forking or using alternatives.","message":"Greenkeeper badge is outdated; package may not be actively updated.","severity":"deprecated","affected_versions":"1.2.3"}],"env_vars":null,"search_vec":"'1.0':8 '1.2.3':20 '4/6/7':15 'allof':72 'array':76 'back':17 'basepath':44 'bidirect':35 'cli':2 'convers':36 'convert':6,80 'data':9 'differenti':34 'draft':14 'dt2js':37 'e.g':66 'extern':41 'hood':32 'issu':75 'item':77 'javascript':81 'js2dt':39 'json':12,68,83 'key':33 'known':64 'librari':4 'like':71 'limit':65 'maintain':21 'mainten':61 'mode':62 'oneof':73 'option':47 'organ':25 'packag':58 'parser':29 'proper':79 'properti':70 'raml':7,24,82 'ramldt2jsonschema':1 'recent':55 'refer':42 'releas':56 'schema':13,69 'stabl':18 'support':40 'type':10,84 'unsupport':67 'use':26 'v1.2.3':50 'valid':46 'version':19 'via':43 'webapi':28 'webapi-pars':27","created_at":"2026-06-07T16:59:47.863289+00:00","updated_at":"2026-06-07T16:59:47.863289+00:00","problems":[{"fix":"npm install webapi-parser","cause":"Missing peer dependency webapi-parser","error":"Error: Cannot find module 'webapi-parser'"},{"fix":"Use named import: const { dt2js } = require('ramldt2jsonschema')","cause":"Incorrect import (default import used)","error":"TypeError: dt2js is not a function"},{"fix":"Verify the type name exists in the RAML file; check spelling and case.","cause":"Type name argument does not exist in RAML file","error":"Error: Input RAML type not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/raml-org/ramldt2jsonschema","github":"git://github.com/raml-org/ramldt2jsonschema","docs":null,"changelog":null,"pypi":null,"npm":"ramldt2jsonschema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}