grunt-jsonschema-amd-restclient-generator

Generate a RequireJS client for REST web services described by a JSON Schema document.

Showing:

Popularity

Downloads/wk

29

GitHub Stars

3

Maintenance

Last Commit

3yrs ago

Contributors

3

Package

Dependencies

8

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

grunt-jsonschema-amd-restclient-generator

Generate an AMD client for REST web services described by a JSON Schema.

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-jsonschema-amd-restclient-generator --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-jsonschema-amd-restclient-generator');

The "jsonschema_amd_restclient_generator" task

Overview

In your project's Gruntfile, add a section named jsonschema_amd_restclient_generator to the data object passed into grunt.initConfig().

grunt.initConfig({
  jsonschema_amd_restclient_generator: {
    custom_options: {
      /* Task-specific options go here. */
    }
  }
});

Options

options.base_url

Type: String

The URI of the JSON Schema.

options.output_name

Type: String

The name of the final AMD library.

Usage Examples

Custom Options

This is an example of the use of the plugin to generate the AMD client for FAOSTAT APIs. The final reslt, FAOSTATClient.min.js, will be available in the dist folder.

'use strict';

module.exports = function (grunt) {

    /* Project configuration. */
    grunt.initConfig({

        /* Plugin configuration. */
        jsonschema_amd_restclient_generator: {
            custom_options: {
                options: {
                    base_url: 'http://localhost:8080/faostat-api/v1.0/',
                    output_name: 'test-client'
                }
            }
        }

    });

    /* Load NPM tasks. */
    grunt.loadNpmTasks('grunt-jsonschema-amd-restclient-generator');

    /* Register task. */
    grunt.registerTask('default', ['jsonschema_amd_restclient_generator']);

};

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100