ajv-validator / ajv-validator/ajv-cli
Merging Defaults with CLI
- Lenguaje dominante
- TypeScript
- Estrellas
- 316
- Forks
- 77
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
**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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.