src/dt2js.js
function dt2js (ramlData, typeName) {
  const ctx = getRAMLContext(ramlData, basePath)
  if (!(ctx instanceof Object)) throw new Error('Invalid RAML data')

  if (ctx[typeName] === undefined) throw new Error('type ' + typeName + ' does not exist')

  const expanded = expandedForm(ctx[typeName], ctx)
  const canonical = canonicalForm(expanded)

  let schema = schemaForm(canonical)
  schema = addRootKeywords(schema)

  return schema
}
function dt2js (ramlData, typeName) {
  const ctx = getRAMLContext(ramlData, basePath)
  if (!(ctx instanceof Object)) throw new Error('Invalid RAML data')

  if (ctx[typeName] === undefined) throw new Error('type ' + typeName + ' does not exist')

  const expanded = expandedForm(ctx[typeName], ctx)
  const canonical = canonicalForm(expanded)

  let schema = schemaForm(canonical)
  schema = addRootKeywords(schema)

  return schema
}
function dt2js ( ramlData , typeName ) { const ctx = getRAMLContext ( ramlData , basePath ) if ( ! ( ctx instanceof Object ) ) throw new Error ( 'Invalid RAML data' ) if ( ctx [ typeName ] === undefined ) throw new Error ( 'type ' + typeName + ' does not exist' ) const expanded = expandedForm ( ctx [ typeName ] , ctx ) const canonical = canonicalForm ( expanded ) let schema = schemaForm ( canonical ) schema = addRootKeywords ( schema ) return schema }
Convert RAML data type to JSON schema.

@param  {string} ramlData - RAML file content.
@param  {string} typeName - Name of the type to be converted.
Convert RAML data type to JSON schema .