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).
npm install ramldt2jsonschemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Converts a RAML data type named 'MyType' from a file 'types.raml' to JSON Schema using the library.
Ensure RAML files are valid per RAML 1.0 spec; check webapi-parser issues for known limitations.
Manually handle unsupported properties; consider using alternative tools for complex schemas.
Always pass { basePath: ... } as third argument when using !include or $ref.Avoid using tuple arrays in JSON Schema if converting to RAML; stay updated on fixes.
Check for newer versions; consider forking or using alternatives.
npm install webapi-parser
Use named import: const { dt2js } = require('ramldt2jsonschema')Verify the type name exists in the RAML file; check spelling and case.