func.yaml schema generator truncates fractional `minimum` values (e.g. 0.01 -> 0)
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- go
- 領域
- testing-qa, tooling
調査の方向性
Start with schema/generator/main.go, then inspect the jsonschema dependency's reflect.go handling of minimum and maximum values. Compare the generated schema/func_yaml-schema.json with ValidateScale for fractional minima. Done means the published schema preserves fractional minimum values and agrees with runtime validation.
索引モデルが issue の本文から書いたものです。
説明
The func.yaml JSON schema is generated with github.com/alecthomas/jsonschema. Its number-keyword handling stores minimum/maximum as int (Type.Minimum int, reflect.go:60) and parses the tag value with strconv.Atoi — for both the jsonschema tag (numbericKeywords, reflect.go:614) and the jsonschema_extras tag (extraKeywords). A fractional minimum such as 0.01 fails to parse, the error is discarded, and the emitted schema gets minimum: 0.
As a result, schema-based validation is looser than the runtime ValidateScale. For example scale.kpa.target requires >= 0.01 at runtime, but the generated schema only enforces > 0 (via an exclusiveMinimum: true workaround), so a value like 0.001 passes the published schema/func_yaml-schema.json while ValidateScale rejects it at deploy time.
This is a pre-existing, generator-wide limitation affecting any fractional minimum (not specific to the scale fields): the library simply cannot express a non-integer minimum.
Possible fixes
- Post-process the generated schema in
schema/generator/main.goto set fractional minima after reflection (targeted, but per-field). - Switch to a jsonschema library / tag path that supports float minima, then regenerate
schema/func_yaml-schema.jsonso schema validation matchesValidateScale.
Context
Surfaced by the Copilot review of #4063:
https://github.com/knative/func/pull/4063#discussion_r4098380996
- 主要言語
- Go
- スター
- 365
- フォーク
- 224
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 17
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
knative/func のほかの issue
-
KEDA deployer: default minReplicaCount prevents scale-to-zero対応中かも @Tushar-Khandelwal-2004 が 111 日前に担当しました。 オープンlifecycle/stale
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
knative/func#3924 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
git/gitlab: default project webhooks to SSL verification when creating hooks対応中かも @Vi-shub が 158 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
mcp: config add/remove handlers bypass readonly guard対応中かも @Elvand-Lie が 160 日前に担当しました。 オープンkind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
knative/func#3704 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
operator sync creates registry auth Secret as Opaque/config.json, incompatible with func-operator (expects dockerconfigjson)対応中かも @gauron99 が 6 日前に担当しました。 オープン
メンテナーはふだん 2 日以内に返信
-
k8s deployer: WaitForDeploymentAvailable errors on a 0-replica Deployment (keda scale-to-zero redeploy)対応中かも @Elvand-Lie が 8 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
validateDeclaredPath lets control characters through into the Gradle init script's Groovy literalオープンagent-butler-finding agent-research bug ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jordansmall/spindrift#5821 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/rocketmq-dashboard#7243 ·
メンテナーはふだん 3 日以内に返信
-
Missing example coverage: getClock対応中かも @camunda-sdk-automation が今日担当しました。 オープンnew-operations
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
camunda/orchestration-cluster-api-go#75 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
praetorianer777/Stator#465 ·
メンテナーはふだん 1 日以内に返信