Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

raml-typesystem

Package Overview
Dependencies
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raml-typesystem

[![Build Status](https://travis-ci.org/raml-org/raml-typesystem.svg?branch=master)](https://travis-ci.org/raml-org/raml-typesystem)

  • 0.0.88
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
decreased by-15.89%
Maintainers
2
Weekly downloads
 
Created
Source

RAML Data Type System

Build Status

This module contains a lightweight implementation of the type system that was introduced with RAML 1.0.

It allows you to to parse, validate , modify RAML types, as well as store them back to JSON.

Installation

npm install raml-typesystem --save

Usage

Parsing and validating a single type:

import ts = require("raml-typesystem")

var personType = ts.loadType( {
    type: "string[]",
    minItems:3,
    maxItems:2
})

var isValid = personType.validateType();

Parsing and validating a types collection:

import ts = require("raml-typesystem")

var typeCollection = ts.loadTypeCollection({
    types: {
        Person: {
            type: "object",
            properties:{
                kind: "string"
            }
        },
        Man: {
            type: "Person",
            discriminator: "kind"
        }
    }
})
var isValid = typeCollection.getType("Person").validateType()

Validating object against type:

import ts = require("raml-typesystem")

var typeCollection = ts.loadTypeCollection({
    types: {
        Person: {
            type: "object",
            properties:{
                kind: "string"
            }
        },
        Man: {
            type: "Person",
            discriminator: "kind"
        }
    }
})
var isValid = typeCollection.getType("Person").validate({dd: true})

Contribute

The raml-typesystem repo is an open source project and any contribution is always welcome. Please follow these simple steps when contributing to this project:

  1. Check for open issues or open a fresh issue to start a discussion around an idea or a bug.
  2. Fork the repository on Github and make your changes on the develop branch (or branch off of it).
  3. Send a pull request (with the develop branch as the target).
  4. One of the main contributor or admin will review the PR and merge.

A big thank you goes out to everyone who helped with the project, the contributors and everyone who took the time to report issues and give feedback.

You can also directly get in touch with us. Simply send us an email to: info@raml.org

Keywords

FAQs

Package last updated on 21 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc