All Projects → zacyang → raml-clj-parser

zacyang / raml-clj-parser

Licence: EPL-1.0 license
A RAML parser implemented in clojure

Programming Languages

clojure
4091 projects
RAML
58 projects

Projects that are alternatives of or similar to raml-clj-parser

raml-dotnet-parser-2
No description or website provided.
Stars: ✭ 17 (-19.05%)
Mutual labels:  raml, raml-parser
Api Workbench
The API Workbench for RAML (deprecated)
Stars: ✭ 222 (+957.14%)
Mutual labels:  raml
Vim Yaml Folds
YAML, RAML, EYAML & SaltStack SLS folding for Vim
Stars: ✭ 59 (+180.95%)
Mutual labels:  raml
Hikaku
A library that tests if the implementation of a REST-API meets its specification.
Stars: ✭ 154 (+633.33%)
Mutual labels:  raml
Commerce Sdk
Stars: ✭ 63 (+200%)
Mutual labels:  raml
Raml Server
run a mocked server JUST based on a RAML API's definition .. zero coding
Stars: ✭ 158 (+652.38%)
Mutual labels:  raml
Web Api
This issue tracker is no longer used. Join us in the Spotify for Developers forum for support with the Spotify Web API ➡️ https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer
Stars: ✭ 944 (+4395.24%)
Mutual labels:  raml
smockin
Dynamic API, S3 & Mail mocking for web, mobile & microservice development.
Stars: ✭ 74 (+252.38%)
Mutual labels:  raml
Raml Js Parser
(deprecated) A RAML parser based on PyYAML written in CoffeScript and available for use as NodeJs module or in-browser.
Stars: ✭ 197 (+838.1%)
Mutual labels:  raml
Raml Js Parser 2
(deprecated)
Stars: ✭ 140 (+566.67%)
Mutual labels:  raml
Raml Client Generator
Template-driven generator of clients for APIs described by a RAML spec
Stars: ✭ 119 (+466.67%)
Mutual labels:  raml
Raml Tester
Test if a request/response matches a given raml definition
Stars: ✭ 70 (+233.33%)
Mutual labels:  raml
Raml Java Parser
(deprecated) A RAML parser based on SnakeYAML written in Java
Stars: ✭ 169 (+704.76%)
Mutual labels:  raml
Raml2html
RAML to HTML documentation generator.
Stars: ✭ 1,108 (+5176.19%)
Mutual labels:  raml
Ramlfications
Python parser for RAML
Stars: ✭ 234 (+1014.29%)
Mutual labels:  raml
Api Designer
A web editor for creating and sharing RAML API specifications
Stars: ✭ 1,019 (+4752.38%)
Mutual labels:  raml
Osprey Mock Service
Generate an API mock service from a RAML definition using Osprey
Stars: ✭ 106 (+404.76%)
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 (+633.33%)
Mutual labels:  raml
api-console-cli
A CLI tools for the API console.
Stars: ✭ 14 (-33.33%)
Mutual labels:  raml
symfony-skeleton
Skeleton rest-api based on symfony
Stars: ✭ 15 (-28.57%)
Mutual labels:  raml

raml-clj-parser Build Status codecov

This is a RAML parser implemented in clojure, which is based on SnakeYaml libarary.

It is able to parse a given raml file into clojure map, including all the included resource (tag !include) and subordinate raml files.

It also provides validtion according to raml spec v08

Version

Clojars Project

Installation

Add the following dependency to your project.clj file:

[raml-clj-parser "0.1.1-SNAPSHOT"]

Usage

Read raml file into clojure map

(require '[raml-clj-parser.core :as raml])

(raml/read-raml "resource/sample.raml")

;; => {:raml-version "0.8", :title "Jukebox API", :baseUri {:uri "http://jukebox.api.com", :raml-clj-parser.reader/uri-parameters []}, :version "v1"}

It will convert all the raml tag into clojure keywords and all the routes into string. And you can use regular clojure fn to navigate though the map and retrieve associated values.

Validate raml content [optional]

The validation is build on Schema for more informatino you could refer to https://github.com/plumatic/schema

(require '[raml-clj-parser.core :as raml])

;;valid raml file
(let [raml_content (raml/read-raml "resource/valid.raml")]
  (raml/validate raml_content))

;; valid raml will return its content
;; => {:raml-version "0.8", :title "Jukebox API", :baseUri {:uri "http://jukebox.api.com", :raml-clj-parser.reader/uri-parameters []}, :version "v1"}

;;invalid raml file
(let [raml_content (raml/read-raml "resource/invalid.raml")
      validation_result (raml/validate raml_content)]
    (:error validation_result)

;; invalid raml will return a map contains the :error for the violation
;; in this case, there some key missing in the raml file
;; => {:title missing-required-key, :raml-version missing-required-key, :baseUri missing-required-key, (not ("Resource must starts with /" :error)) invalid-key}

Util fn (WIP)

;;for a parsed raml file
(get-abs-uri raml ["/sub_uri" "/sub_uri"])
;;=> will return a map contains the leaf resources's information including uri parameter and header

License

Copyright © 2017 FIXME

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

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].