ajv-validator / ajv-validator/ajv-cli

Merging Defaults with CLI

オープン
#191 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。