Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

in some cases, the verification result is wrong

オープン
#34 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
lua
領域
tooling

調査の方向性

Start with the provided Lua reproducer and the jsonschema.generate_validator entry point, then compare validation when the oneOf alternatives are ordered differently. The issue is done when the empty configuration and the {"clock_skew": 300} configuration produce consistent, correct verification results regardless of oneOf item order.

索引モデルが issue の本文から書いたものです。

説明

bug

wrong case:

local schema = {
    type = "object",
    oneOf = {        
        {
            title = "work with consumer object",
            properties = {
                access_key = {type = "string", minLength = 1, maxLength = 256},
                secret_key = {type = "string", minLength = 1, maxLength = 256},
                algorithm = {
                    type = "string",
                    enum = {"hmac-sha1", "hmac-sha256", "hmac-sha512"},
                    default = "hmac-sha256"
                },
                clock_skew = {
                    type = "integer",
                    default = 300
                },
                signed_headers = {
                    type = "array",
                    items = {
                        type = "string",
                        minLength = 1,
                        maxLength = 20,
                    }
                },
            },
            required = {"access_key", "secret_key"},
            additionalProperties = false,
        },
    },
        {
            title = "work with route or service object",
            properties = {},
            additionalProperties = false,
        }
}


local validator = jsonschema.generate_validator(schema)

local conf = {}
local ok = validator(conf)

if not ok then
  ngx.say("value checking failure")
  return
end

If I change the order of items of the schema object , it will be ok:

local schema = {
    type = "object",
    oneOf = {
        {
            title = "work with route or service object",
            properties = {},
            additionalProperties = false,
        },    
        {
            title = "work with consumer object",
            properties = {
                access_key = {type = "string", minLength = 1, maxLength = 256},
                secret_key = {type = "string", minLength = 1, maxLength = 256},
                algorithm = {
                    type = "string",
                    enum = {"hmac-sha1", "hmac-sha256", "hmac-sha512"},
                    default = "hmac-sha256"
                },
                clock_skew = {
                    type = "integer",
                    default = 300
                },
                signed_headers = {
                    type = "array",
                    items = {
                        type = "string",
                        minLength = 1,
                        maxLength = 20,
                    }
                },
            },
            required = {"access_key", "secret_key"},
            additionalProperties = false,
        },
    },
}


local validator = jsonschema.generate_validator(schema)

local conf = {}
local ok = validator(conf)

if not ok then
  ngx.say("value checking failure")
  return
end

In the wrong case, conf had been change to {"clock_skew": 300}.

I think this is the reason.

主要言語
Lua
スター
136
フォーク
29
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

api7/jsonschema のほかの issue

api7/jsonschema の issue をすべて見る

似ている issue

Lua の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。