zigorou / perl-JSV

JSON Schema implementation for Perl
Other
25 stars 17 forks source link

Add JSV::Keyword::Draft4::Format #13

Closed tmitz closed 10 years ago

tmitz commented 10 years ago

Add format definition

tmitz commented 10 years ago

モジュールまで教えてもらってありがとうございます。 validate部分は乗っかるように修正しまうす!

zigorou commented 10 years ago

あとそもそも論として、format キーワードは 7.2. Implementation requirements において、

Implementations MAY support the "format" keyword. Should they choose to do so:

  • they SHOULD implement validation for attributes defined below;
  • they SHOULD offer an option to disable validation for this keyword. Implementations MAY add custom format attributes. Save for agreement between parties, schema authors SHALL NOT expect a peer implementation to support this keyword and/or custom format attributes.

と書かれていて、format はサポートされる場合があると、で下記のいずれかを選択せよと。

後者が良いかなぁと思うので、いずれこのモジュールが選択出来るようなオプションを JSV::Validator 自身に付けたいなとは思っております。 今そこまでやる必要は無いですが。

tmitz commented 10 years ago

後者が良いかなぁと思うので、いずれこのモジュールが選択出来るようなオプションを JSV::Validator 自身に付けたいなとは思っております。

hmhm, newするときに { format => 0 } とかで無効にする感じですかね。もしくはformat形式ごとにON/OFF指定とか。

tmitz commented 10 years ago

@zigorou

validateするところはCPANモジュール使うように処理置き換えております。

tmitz commented 10 years ago

JSV::Context導入による変更点も取り込みました

zentooo commented 10 years ago

lgtm