ajv-validator / ajv-validator/ajv-cli

Merging Defaults with CLI

Aberta
#191 2 comentários 1 reação 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
316
Forks
77
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

**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.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.