{"library":"raml-1-parser","title":"RAML 1.0 JavaScript Parser","description":"The `raml-1-parser` is a JavaScript and TypeScript parser library designed for RAML (RESTful API Modeling Language) specifications, offering support for both RAML 0.8 and 1.0 versions. It facilitates the parsing of RAML files from various sources (filesystem paths or URLs) into a structured JSON representation of the API definition, which is useful for API introspection, documentation generation, and tooling development. The current stable version is 1.1.67, with its last significant feature update, including circular reference support, occurring in v1.1.52. This package maintains a slow release cadence, primarily for dependency and security updates. A critical detail for users is that this parser is officially deprecated by the RAML organization. While it once provided comprehensive RAML 1.0 support, its current status means it no longer receives active feature development or consistent security patching. Users are strongly advised to migrate to `@raml-org/webapi-parser` for ongoing maintenance and support.","language":"javascript","status":"deprecated","last_verified":"Sun Apr 19","install":{"commands":["npm install raml-1-parser"],"cli":null},"imports":["const raml = require('raml-1-parser');","import { load } from 'raml-1-parser';","const { parse } = require('raml-1-parser');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { load } from 'raml-1-parser';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\n// Create a dummy RAML file for the example\nconst exampleRamlContent = `#%RAML 1.0\\n  title: My Example API\\n  version: v1\\n  baseUri: https://api.example.com/{version}\\n  /status:\\n    get:\\n      description: Check API health\\n      responses:\\n        200:\\n          body:\\n            application/json:\\n              type: object\\n              properties:\\n                status: string\\n                timestamp: datetime\\n`;\nconst ramlFileName = path.join(process.cwd(), 'example.raml');\nfs.writeFileSync(ramlFileName, exampleRamlContent);\n\nasync function parseRamlFile() {\n  try {\n    console.log(`Attempting to parse RAML file from: ${ramlFileName}`);\n    // The 'load' function is asynchronous, returning a Promise.\n    // A synchronous version, 'loadRAMLSync', is also available.\n    const apiDefinition = await load(ramlFileName);\n\n    console.log('Successfully parsed RAML API Definition:');\n    // The parsed object has a toJSON() method for serializing the model.\n    console.log(JSON.stringify(apiDefinition.toJSON(), null, 2));\n\n  } catch (error: any) {\n    console.error('Error parsing RAML file:', error.message || error);\n    if (error.errors) { // Parsers often return detailed error arrays\n      console.error('Validation errors:', JSON.stringify(error.errors, null, 2));\n    }\n  } finally {\n    // Clean up the dummy file\n    if (fs.existsSync(ramlFileName)) {\n      fs.unlinkSync(ramlFileName);\n      console.log(`Cleaned up temporary file: ${ramlFileName}`);\n    }\n  }\n}\n\nparseRamlFile();","lang":"typescript","description":"Demonstrates how to asynchronously load and parse a RAML 1.0 API definition from a local file, then serialize its parsed JSON representation.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}