Git Product home page Git Product logo

spec-generator's Introduction

Spec Generator

This exposes a service to automatically generate specs from various source formats.

API

Spec Generator has a single endpoint, which is a GET /. This endpoint accepts parameters on its query string. If the call is successful the generated content of the specification is returned.

  • type (required). The type of generator for this content. Currently the only supported value is respec.
  • url (required). The URL of the draft to fetch and generate from.
  • publishDate. The date at which the publication of this draft is supposed to occur.

Errors

If a required parameter is missing or has a value that is not understood, the generator returns a 500 error with a JSON payload the error field of which is the human-readable error message.

If the specific generator encounters a problem a similar error (mostly likely 500) with the same sort of JSON message is returned. Specific generator types can extend this behaviour. The respec generator only returns 500 errors.

Writing generators

Generators are simple to write and new ones can easily be added. Simply add a new one under generators and load it into the genMap near the top of server.js.

Generators must export a generate() method which takes a URL, a set of parameters (from the list of optional ones that the API supports), and a callback to invoke upon completion.

If there is an error, the callback's first argument must be an object with a status field being an HTTP error code and a message field containing the error message. If the generator is successful the first argument is null and the second is the generated content.

Running

The generator for ReSpec requires a running X server; in a headless environment, you will need to run it in connection with a Xvfb instance:

Xvfb :3  &  # (where 3 is the display port)
DISPLAY=:3 node server.js

A sufficient (but perhaps more than necessary) set of packages in a Debian/Ubuntu environment is xvfb x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps clang libdbus-1-dev libgtk2.0-dev libnotify-dev libgnome-keyring-dev libgconf2-dev libasound2-dev libcap-dev libcups2-dev libxtst-dev libxss1 libnss3-dev gcc-multilib g++-multilib.

spec-generator's People

Contributors

dontcallmedom avatar deniak avatar plehegar avatar darobin avatar tripu avatar tidoust avatar

Watchers

 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.