[ANN] Kwalify 0.7.2 - parser, schema validator, and data binding forYAML and JSON

Discussion in 'Ruby' started by makoto kuwata, Jul 18, 2010.

  1. Hi,

    I released Kwalify 0.7.2. This is a bug fix release.
    http://www.kuwata-lab.com/kwalify/


    Overview
    --------

    Kwalify is an integrated tool for YAML and JSON.
    Kwalify contains parser, schema validator, and data binding tool.

    See User's Guide for details.
    http://www.kuwata-lab.com/kwalify/ruby/users-guide.html


    Example
    -------

    Schema example (schema.yaml):

    type: seq
    sequence:
    - type: map
    class: Member
    mapping:
    "name": { type: str, required: true }
    "gender": { type: str, required: true, enum: [M, F] }
    "role": { type: str, required: false }


    YAML data example (data.yaml):

    - name: Haruhi Suzumiya
    gender: F
    role: Leader of SOS Brigade
    - name: Mikuru Asahina
    gender: W
    role: Time Traveler
    - namae: Yuki Nagato
    gender: F
    role: Humanoid Interface


    Schema validation example:

    $ kwalify -lf sos.schema sos.data
    sos.data#0: INVALID
    - (line 5) [/1/gender] 'W': invalid gender value.
    - (line 7) [/2] key 'name:' is required.
    - (line 7) [/2/namae] key 'namae:' is undefined.


    Class generation example:

    $ kwalify -a genclass-java -f schema.yaml
    generating ./Member.java...done.
    $ cat ./Member.java
    // generated by kwalify from schema.yaml

    import java.util.*;

    /**
    *
    */
    public class Member {

    private String _name;
    private String _gender;
    private String _role;

    public Member() {}

    public Member(Map map) {
    _name = (String)map.get("name");
    _gender = (String)map.get("gender");
    _role = (String)map.get("role");
    }

    public String getName() { return _name; }
    public void setName(String name_) { _name = name_; }
    public String getGender() { return _gender; }
    public void setGender(String gender_) { _gender = gender_; }
    public String getRole() { return _role; }
    public void setRole(String role_) { _role = role_; }
    }


    Changes from 0.7.1
    ------------------

    * [bugfix] fix kwalify command not to raise error when YAML document
    is empty (thanks to Nuttall).
    * [bugfix] fix Kwalify::Util.untabify() not to remove tailing empty
    strings.


    --
    regards,
    makoto kuwata
     
    makoto kuwata, Jul 18, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kwatch
    Replies:
    0
    Views:
    170
    kwatch
    May 30, 2006
  2. makoto kuwata
    Replies:
    0
    Views:
    139
    makoto kuwata
    Jan 27, 2008
  3. Jean-Christophe Le Lann

    require 'kwalify' fails

    Jean-Christophe Le Lann, Feb 4, 2011, in forum: Ruby
    Replies:
    1
    Views:
    89
    Jörg W Mittag
    Feb 5, 2011
  4. Jörg Weule
    Replies:
    20
    Views:
    1,274
    Arno Welzel
    Dec 2, 2011
  5. Acácio Centeno
    Replies:
    1
    Views:
    261
    dieter
    Feb 15, 2013
Loading...

Share This Page