Repository navigation
fix: allow "unlimited" for integer keep-* flags in JSON schema - #683
creativeprojects merged 2 commits into
Conversation
restic accepts "unlimited" as an alternative to a count for the integer keep-* retention flags, but the generated JSON schema only allowed integers. Allow the string value "unlimited" for these flags, and filter enum values per schema type so the "unlimited" enum only applies to the string branch of the schema.
|
No actionable comments were generated in the recent review. WalkthroughInteger options named with the ChangesKeep flag schema support
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk:
|
creativeprojects
left a comment
There was a problem hiding this comment.
Thank you for this PR!
I like that the AI also tested the generated JSON schema 👍🏻
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #683 +/- ##
=======================================
Coverage 85.42% 85.42%
=======================================
Files 161 161
Lines 10396 10399 +3
=======================================
+ Hits 8880 8883 +3
Misses 1516 1516
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Fixes #449
restic accepts
unlimitedas an alternative to a count for the integerkeep-*retention flags (as documented in the restic help text), but the generated JSON schema only allowed integers, so editors flagged valid configurations like:Changes
config: for integerkeep-*restic flags, the property info now also allows the string valueunlimited(other integer flags such aslimit-downloadare unchanged).config/jsonschema: enum values are now filtered per schema type, mirroring how defaults and examples are already filtered. Without this, theunlimitedenum would leak into theintegerbranch of the schema and make every numeric value invalid.The generated schema renders
keep-dailyas:{ "oneOf": [ { "type": "integer" }, { "type": "string", "enum": ["unlimited"] } ] }Testing
keep-*vslimit-downloadvs durationkeep-within)oneOfforkeep-dailyin the retention section, and thatlimit-downloadstays integer-onlyEnumcase ofTestConfigureBasicInfofor the per-type filteringgo test ./config/...passes;golangci-lint run ./config/...(v2.12.2) reports 0 issues