Prev: [ANN] Call for Participation for 2010 Workshop on Scheme and Functional Programming
Next: ruby abstraction
From: makoto kuwata on 17 Jul 2010 20:50 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 |