ajv-validator / ajv-validator/ajv-cli
Merging Defaults with CLI
- 主要語言
- TypeScript
- 星號
- 316
- 分支
- 77
- PR 合併指標
- 30 天內沒有已合併 PR
描述
**What version of Ajv you are you using?**
`ajv@8.6.3`
**What problem do you want to solve?**
I'm actually not sure if I'm missing a setting or just getting confused by the docs, but I was hoping to use the cli and the `--use-defaults` option to produce the merged JSON output, as is done in scripting.
**What do you think is the correct solution to problem?**
Based on the [documentation](https://ajv.js.org/guide/modifying-data.html#assigning-defaults) indicating this function modified data, I expected the cli to either edit the data file in place, or else output the combined JSON (either would be fine).
The closest thing currently possible appears to be returning a JSON patch which would yield the data complete with defaults, but a) I can't seem to find any CLI tools that apply JSON patches and b) It seems like it would be a bit hacky in any case as the result of the validation is mixed into stdout with the diff.
As for implementing this, the paths of least resistance would seem to be supporting the `-o` argument in validations and/or supporting a `merged` value for the `--changes` argument. I would also suggest moving status messages about validation to standard error.
**Will you be able to implement it?**
Probably not due to time constraints and my lack of familiarity with the code, but I suspect this would be fairly trivial as this is already possible via the api.
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。