Coder Social home page Coder Social logo

tklever / api-elements.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apiaryio/api-elements.js

0.0 0.0 0.0 4.01 MB

Library for consuming API Elements in JavaScript

Home Page: https://apielements.org/

License: MIT License

Shell 0.12% JavaScript 99.05% PEG.js 0.83%

api-elements.js's Introduction

API Elements: JavaScript

API Elements is a uniform interface for dealing with API description formats (API Blueprint, OpenAPI, ...). This repository contains tooling for handling API Elements in JavaScript along with parsers and serializers for API description languages. @apielements/cli provides a command line interface to API Elements which can be used to validate API Description Documents.

API Elements adapters:

Usage

const { Fury } = require('@apielements/core');

const fury = new Fury();

// Load any parsers or serializer adapters you wish to use
const apiBlueprintParser = require('@apielements/apib-parser');
fury.use(apiBlueprintParser);

const openAPI2Parser = require('@apielements/openapi2-parser');
fury.use(openAPI2Parser);

const source = `
FORMAT: 1A

# My API
## GET /message
+ Response 200 (text/plain)

        Hello World!
`;

fury.parse({source}, (error, parseResult) => {
  console.log(parseResult.api.title);
});

See API Reference documentation for the details about the ParseResult object and other elements interface in JavaScript.

API Elements Reference contains information regarding the design of various API Elements.

Development

Using Lerna

Install dependencies of all packages:

$ npm install --global yarn
$ yarn

NOTE: Please do commit the yarn.lock to the GitHub repo

To list all packages:

$ npx lerna ls -a -l

To add a new dependency to a package:

$ npx lerna add --scope='package_name' dep@version

To run tests for a single package:

$ npx lerna exec --scope='package_name' -- npm run test

Documentation

The documentation is built using Sphinx, a Python tool. Assuming you have Python 3 and pipenv installed, the following steps can be used to build the site.

$ cd docs
$ pipenv install --dev

Running the Development Server

You can run a local development server to preview changes using the following:

$ cd docs
$ pipenv run serve

api-elements.js's People

Contributors

kylef avatar pksunkara avatar danielgtaylor avatar smizell avatar dependabot-preview[bot] avatar klokane avatar tjanc avatar greenkeeper[bot] avatar honzajavorek avatar patricksmms avatar w-vi avatar zdne avatar opichals avatar jackub avatar freaz avatar paulodiovani avatar abtris avatar lulco avatar realityking avatar thomasruiz avatar abacaphiliac avatar artem-zakharchenko avatar m-baumgartner avatar pedrohbtp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.