ajv-validator / ajv-validator/ajv-keywords

Order of operations for `transform` and custom keywords

Aberta
#390 2 comentários 2 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
257
Forks
51
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

I understand that standard keywords, such as `format` will be run before any custom keywords, such as `transform`. So if we want to transform a string BEFORE validating its format, we have to use `$allOf` to force the order.

In my case, we're considering using `transform` to turn a proprietary version number format into something close to a semver, then using the `semver` keyword from the [`ajv-semver`](https://www.npmjs.com/package/ajv-semver) to validate and clean up the coercion.

What would determine the order?
- The order the keywords are added to `ajv`
- The order the keywords appear in the JSONSchema

Can we count on the order?

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.