Skip to content

feat: restrict root-level keys in runbook JSON schema - #1427

Merged
k1LoW merged 1 commit into
mainfrom
improve-json-schema
Mar 25, 2026
Merged

k1LoW merged 1 commit into
mainfrom
improve-json-schema

Conversation

@k1LoW

@k1LoW k1LoW commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add anchors property for YAML anchor definitions at root level
  • Add x- patternProperties for extension fields (OpenAPI-style)
  • Set additionalProperties: false at root level to reject unknown keys (e.g. typos)
  • Update test fixtures to use anchors: instead of arbitrary key names
  • Add test case to verify unknown root-level keys are rejected

Add `anchors` property and `x-` patternProperties to allow YAML anchor
definitions, while setting additionalProperties to false to reject
unknown root-level keys (e.g. typos).
@k1LoW k1LoW self-assigned this Mar 25, 2026
@k1LoW k1LoW added the enhancement New feature or request label Mar 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

BenchmarkManyRunbooks-4

main (-) #1427 (53d50c9) +/-
Number of iterations 1 1 0
Nanoseconds per iteration 3,619,549,591 ns/op 3,729,930,470 ns/op 110,380,879 ns/op
Bytes allocated per iteration 1,391,297,048 B/op 1,391,058,952 B/op -238,096 B/op
Allocs per iteration 19,349,948 allocs/op 19,349,438 allocs/op -510 allocs/op
Metadata
main (-) #1427 (53d50c9)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

BenchmarkOpenAPI3-4

main (-) #1427 (53d50c9) +/-
Number of iterations 1 1 0
Nanoseconds per iteration 1,452,905,518 ns/op 1,601,824,362 ns/op 148,918,844 ns/op
Bytes allocated per iteration 812,085,392 B/op 812,367,608 B/op 282,216 B/op
Allocs per iteration 11,322,954 allocs/op 11,323,315 allocs/op 361 allocs/op
Metadata
main (-) #1427 (53d50c9)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

BenchmarkSingleRunbook-4

main (-) #1427 (53d50c9) +/-
Number of iterations 22 22 0
Nanoseconds per iteration 46,121,421 ns/op 45,866,252 ns/op -255,169 ns/op
Bytes allocated per iteration 23,011,735 B/op 22,987,324 B/op -24,411 B/op
Allocs per iteration 186,784 allocs/op 186,777 allocs/op -7 allocs/op
Metadata
main (-) #1427 (53d50c9)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

Reported by octocov

@github-actions

Copy link
Copy Markdown
Contributor

Code Metrics Report

main (0c35476) #1427 (53d50c9) +/-
Coverage 60.2% 60.2% +0.0%
Code to Test Ratio 1:0.8 1:0.8 0.0
Test Execution Time 8m13s 7m37s -36s
Details
  |                     | main (0c35476) | #1427 (53d50c9) |  +/-  |
  |---------------------|----------------|-----------------|-------|
+ | Coverage            |          60.2% |           60.2% | +0.0% |
  |   Files             |             81 |              81 |     0 |
  |   Lines             |           9303 |            9303 |     0 |
+ |   Covered           |           5607 |            5608 |    +1 |
  | Code to Test Ratio  |          1:0.8 |           1:0.8 |   0.0 |
  |   Code              |          17456 |           17456 |     0 |
  |   Test              |          14568 |           14568 |     0 |
+ | Test Execution Time |          8m13s |           7m37s |  -36s |

Code coverage of files in pull request scope (70.0% → 70.5%)

Files Coverage +/- Status
internal/expr/expr.go 65.9% +0.7% affected
schema_test.go 93.1% 0.0% modified

Reported by octocov

@k1LoW
k1LoW merged commit 35d4a11 into main Mar 25, 2026
9 checks passed
@k1LoW
k1LoW deleted the improve-json-schema branch March 25, 2026 23:45
@github-actions github-actions Bot mentioned this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址