SYNOPSIS

        use JSON::Schema::Shorthand;
    
        my $schema = js_shorthand({
            object => { foo => 'number', bar => { type => 'string', required => 1 }         
        });
    
        # $schema is 
        # { 
        #   type => 'object',
        #   properties => {
        #       foo => { type => 'number' },
        #       bar => { type => string },
        #  }
        #  required => [ 'bar' ],
        # }
        

DESCRIPTION

    JSON Schema is a useful beast, but its schema definition can be a
    little bit more long-winded than necessary. This module allows to use a
    few shortcuts that will be expanded into their canonical form.

    CAVEAT: the module is still very young, and there are plenty of
    properties this module should expand and does not. So don't trust it
    blindly. If you hit such a case, raise a ticket and I'll refine the
    process.

 js_shorthand

        my $schema = js_shorthand $shorthand;

    The module exports a single function, js_shorthand, that takes in a
    JSON schema in shorthand notation and returns the expanded, canonical
    schema form.

    If you don't like the name js_shorthand, you can always import it under
    a different name in your namespace.

        use JSON::Schema::Shorthand 'js_shorthand' => { -as => 'expand_json_schema' };
    
        ...;
    
        my $schema = expand_json_schema $shorthand;

  Types as string

    If a string type is encountered where a property definition is
    expected, the string is expanded to the object { "type": type }.

        {
            "foo": "number",
            "bar": "string"
        }

    expands to

        {
            "foo": { "type": "number" },
            "bar": { "type": "string" }
        }

    If the string begins with a #, the type is assumed to be a reference
    and #type is expanded to { "$ref": type }.

        { "foo": "#/definitions/bar" } 

    becomes

        { "foo": { "$ref": "#/definitions/bar" } }

  object property

    { object: properties } expands to { type: "object", properties }.

        shorthand                              expanded
        ------------------------               ---------------------------
        foo: {                                  foo: {
            object: {                               type: "object",
                bar: { }                            properties: {
            }                                           bar: { }
        }                                           }
                                                }

  array property

    { array: items } expands to { type: "array", items }.

        shorthand                              expanded
        ------------------------               ---------------------------
        foo: {                                  foo: {
            array: 'number'                         type: "array",
        }                                           items: {
                                                        type: 'number' 
                                                    }
                                                }

  required property

    If the required attribute is set to true for a property, it is bubbled
    up to the required attribute of its parent object.

        shorthand                              expanded
        ------------------------               ---------------------------
    
        foo: {                                  foo: {
            properties: {                           required: [ 'bar' ],
              bar: { required: true },              properties: { 
              baz: { }                                bar: {},
            }                                         baz: {}
        }                                       }
                                                

SEE ALSO

    * JSON Schema specs - http://json-schema.org/

    * JavaScript version of this module -
    http://github.com/yanick/json-shema-shorthand

POD ERRORS

    Hey! The above document had some coding errors, which are explained
    below:

    Around line 49:

      Unknown directive: =head2Shorthands

