All Projects → raml-org → Raml Js Parser

raml-org / Raml Js Parser

(deprecated) A RAML parser based on PyYAML written in CoffeScript and available for use as NodeJs module or in-browser.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Raml Js Parser

Docs
轻芒对外服务的文档说明
Stars: ✭ 397 (+101.52%)
Mutual labels:  raml
Commerce Sdk
Stars: ✭ 63 (-68.02%)
Mutual labels:  raml
Hikaku
A library that tests if the implementation of a REST-API meets its specification.
Stars: ✭ 154 (-21.83%)
Mutual labels:  raml
Ramses Example
Example of a Pyramid app that uses ramses
Stars: ✭ 19 (-90.36%)
Mutual labels:  raml
Vim Yaml Folds
YAML, RAML, EYAML & SaltStack SLS folding for Vim
Stars: ✭ 59 (-70.05%)
Mutual labels:  raml
Raml ruby
Raml Ruby
Stars: ✭ 95 (-51.78%)
Mutual labels:  raml
Raml For Jax Rs
This project is all about two way transformation of JAX-RS-annotated Java code to RAML API description and back.
Stars: ✭ 294 (+49.24%)
Mutual labels:  raml
Raml Java Parser
(deprecated) A RAML parser based on SnakeYAML written in Java
Stars: ✭ 169 (-14.21%)
Mutual labels:  raml
Raml2html
RAML to HTML documentation generator.
Stars: ✭ 1,108 (+462.44%)
Mutual labels:  raml
Raml Js Parser 2
(deprecated)
Stars: ✭ 140 (-28.93%)
Mutual labels:  raml
Api Console
An interactive REST console based on RAML/OAS files
Stars: ✭ 848 (+330.46%)
Mutual labels:  raml
Api Designer
A web editor for creating and sharing RAML API specifications
Stars: ✭ 1,019 (+417.26%)
Mutual labels:  raml
Osprey Mock Service
Generate an API mock service from a RAML definition using Osprey
Stars: ✭ 106 (-46.19%)
Mutual labels:  raml
Osprey
Generate Node.JS API middleware from a RAML definition
Stars: ✭ 429 (+117.77%)
Mutual labels:  raml
Raml Examples
This repository contains valid RAML 1.0 examples. These examples are not only part of the spec, but also represent RAML features in different scenarios.
Stars: ✭ 154 (-21.83%)
Mutual labels:  raml
Raml Spec
RAML Specification
Stars: ✭ 3,759 (+1808.12%)
Mutual labels:  raml
Raml Tester
Test if a request/response matches a given raml definition
Stars: ✭ 70 (-64.47%)
Mutual labels:  raml
Raml Dotnet Tools
Visual Studio extension to work with RAML and OAS (OpenAPI) specifications. You can consume REST APIs, scaffold ASP.NET implementations and extract RAML specifications from existing ASP.Net apps.
Stars: ✭ 171 (-13.2%)
Mutual labels:  raml
Raml Server
run a mocked server JUST based on a RAML API's definition .. zero coding
Stars: ✭ 158 (-19.8%)
Mutual labels:  raml
Raml Client Generator
Template-driven generator of clients for APIs described by a RAML spec
Stars: ✭ 119 (-39.59%)
Mutual labels:  raml

RAML Parser

![Gitter](https://badges.gitter.im/Join Chat.svg)

Build Status Dependency Status

This is a JavaScript parser for RAML version 0.8 as defined in the 0.8 RAML specification

A newer version is now available as a beta. It supports RAML 1.0 as well as RAML 0.8.

Contributing

If you are interested in contributing some code to this project, thanks! Please first read and accept the Contributors Agreement.

To discuss this project, please use its github issues or the RAML forum.

Usage for NodeJS

Load

Loading a RAML file is as easy as follows:

  var raml = require('raml-parser');

  raml.loadFile('myAPI.raml').then( function(data) {
    console.log(data);
  }, function(error) {
    console.log('Error parsing: ' + error);
  });

You can alternatively load from a string containing the api definition:

  var raml = require('raml-parser');

  var definition = [
    '#%RAML 0.8',
    '---',
    'title: MyApi',
    'baseUri: http://myapi.com',
    '/Root:'
  ].join('\n');

  raml.load(definition).then( function(data) {
    console.log(data);
  }, function(error) {
    console.log('Error parsing: ' + error);
  });

The shape of the returned object is (unofficially) documented in this Typescript interface.

Abstract Syntax Tree

Generating an AST from a RAML file is as easy as follows:

  var raml = require('raml-parser');

  var myAPI;
  raml.composeFile('myAPI.raml').then( function(rootNode) {
    console.log('Root Node: ' + rootNode)
  }, function(error) {
    console.log('Error parsing: ' + error);
  });

you can also alternatively generate an AST from a string containing the api definition:

  var raml = require('raml-parser');

  var definition = [
    '#%RAML 0.8',
    '---',
    'title: MyApi',
    'baseUri: http://myapi.com',
    '/Root:'
  ].join('\n');

  raml.compose(definition).then( function(rootNode) {
    console.log('Root Node: ' + rootNode)
  }, function(error) {
    console.log('Error parsing: ' + error);
  });

Usage for In-Browser

Using the RAML parser from inside the browser requires the user to actually include the RAML javascript file in a script tag as follows:

<script src="raml-parser.min.js"></script>

from there on the usage is pretty much the same as NodeJS, the script defines a RAML.Parser object globally which can be used as follows:

RAML.Parser.loadFile('http://localhost:9001/myAPI.raml').then( function(data) {
  console.log(data)
}, function(error) {
  console.log('Error parsing: ' + error);
});

Notice that the in-browser version can fetch remote API definitions via XHR.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].