0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

JSON Schema Validator のバグを発見した

Posted at

1. JSON Schema Validator

JSON インスタンスが JSON Schema に適合するか検証するツール

2. バグ詳細

正規表現 "^hoge$" が 文字列 "hoge\n" にマッチする。

image.png
図1. 不正に正規表現がマッチする様子

JSON Schema の公式サイト

では、

$: Matches only at the end of the string.
(引用者訳: $: 文字列の末尾にのみマッチする)

と記述されているため、JavaScript の正規表現で m オプションを付けたときのように「改行直前」で $ がマッチする挙動は誤りである。

実際、競合ツール

で全く同じ検証を行うと、こちらでは正規表現 "^hoge$" が 文字列 "hoge\n" にマッチしない旨のエラーが出る。

image.png
図2. 競合ツールで、正規表現がマッチしない様子 (仕様通り)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?