-
Notifications
You must be signed in to change notification settings - Fork 0
[] Create helm/values.schema.json with JSON Schema validation including enum, minimum, and if/then dependency rules #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "type": "object", | ||
| "additionalProperties": true, | ||
| "properties": { | ||
| "global": { | ||
| "type": "object", | ||
| "properties": { | ||
| "databaseType": { | ||
| "type": "string", | ||
| "enum": ["internal", "external"] | ||
| }, | ||
| "storageClass": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "replicaCount": { | ||
| "type": "integer", | ||
| "minimum": 1 | ||
| }, | ||
| "autoscaling": { | ||
| "type": "object", | ||
| "properties": { | ||
| "enabled": { | ||
| "type": "boolean" | ||
| }, | ||
| "minReplicas": { | ||
| "type": "integer", | ||
| "minimum": 1 | ||
| }, | ||
| "maxReplicas": { | ||
| "type": "integer", | ||
| "minimum": 1 | ||
| }, | ||
| "targetCPUUtilizationPercentage": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "maximum": 100 | ||
| } | ||
| } | ||
| }, | ||
| "ingress": { | ||
| "type": "object", | ||
| "properties": { | ||
| "enabled": { | ||
| "type": "boolean" | ||
| }, | ||
| "host": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "externalDatabase": { | ||
| "type": "object", | ||
| "properties": { | ||
| "host": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| }, | ||
| "persistence": { | ||
| "type": "object", | ||
| "properties": { | ||
| "repositories": { | ||
| "type": "object", | ||
| "properties": { | ||
| "size": { | ||
| "type": "string", | ||
| "pattern": "^[0-9]+[KMGT]i?$" | ||
| }, | ||
| "retainOnDelete": { | ||
| "type": "boolean" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "ssh": { | ||
| "type": "object", | ||
| "properties": { | ||
| "serviceType": { | ||
| "type": "string", | ||
| "enum": ["LoadBalancer", "NodePort", "ClusterIP"] | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "if": { | ||
| "properties": { | ||
| "ingress": { | ||
| "properties": { | ||
| "enabled": { | ||
| "const": true | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "required": ["ingress"] | ||
| }, | ||
| "then": { | ||
| "properties": { | ||
| "ingress": { | ||
| "required": ["host"], | ||
| "properties": { | ||
| "host": { | ||
| "minLength": 1 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "allOf": [ | ||
| { | ||
| "if": { | ||
| "properties": { | ||
| "global": { | ||
| "properties": { | ||
| "databaseType": { | ||
| "const": "external" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "then": { | ||
| "properties": { | ||
| "externalDatabase": { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 [high] JSON Schema では ingress側(トップレベル 該当箇所: "if": {
"properties": {
"global": {
"properties": {
"databaseType": {
"const": "external"
}
}
}
}
},実際には @@ -116,7 +116,8 @@
"if": {
"properties": {
"global": {
"properties": {
"databaseType": { "const": "external" }
}
}
- }
+ },
+ "required": ["global"]
},
|
||
| "required": ["host"], | ||
| "properties": { | ||
| "host": { | ||
| "minLength": 1 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 [critical] external モード時に externalDatabase オブジェクト欠落を検証できない PRD は 該当箇所: "then": {
"properties": {
"externalDatabase": {
"required": ["host"],
"properties": {
"host": {
"minLength": 1
}
}
}
}
}
@@ -129,6 +129,7 @@
"then": {
+ "required": ["externalDatabase"],
"properties": {
"externalDatabase": {
"required": ["host"],
|
||
| ] | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 [critical] トップレベルの
if/thenとallOfを併用するとセマンティクスが壊れるJSON Schema draft-07 ではキーワードは独立して評価されます。
if/thenをトップレベルに直書きしつつallOfも存在する場合、両者は問題なく共存しますが、トップレベルのif/thenはallOf内に入っていないため、外側のifがfalseの場合(ingressが存在しないかenabledがtrueでない場合)にthenは無視されます。これ自体はドラフト-07 の仕様通りですが、より重大な問題はallOfと同階層にif/thenを置く構造の一貫性のなさです。PRD では「外部DBのif/thenはallOf経由」と明示されているのに、ingress のif/thenだけがトップレベルに分離されており、将来ルールを追加する際にallOfと混在して管理が困難になります。両方をallOfに統一すべきです。該当箇所:
code.schema.if_then_allof_conflict| confidence: 0.92