Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

284
Visualizações
Print the current (wrong) data in an Ajv error message

I wish to make Ajv print the piece of my data that is wrong when an error is detected.

I'll make a couple of examples of how Ajv currently behaves and how I wish for it to act:


Example 1
  • schema: {const:"hello!"}
  • data: "hi"
  • error reported by Ajv: data must be equal to constant
  • error I wish to see: data ("hi") must be equal to constant ("hello!")
Example 2
  • schema: {type:"object", properties:{"x":{}}, additionalProperties:false}
  • data: {x:1, y:2}
  • error reported by Ajv: data must NOT have additional properties
  • error I wish to see: data must NOT have additional properties (found "y")

And so on and so forth. I want more information to help me debug my data for any kind of error, anywhere in the data.

I found lots of information pointing to the ajv-errors package but couldn't figure out how to use it to achieve what I want.

Could anyone suggest if it's possible to achieve what I want and how?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda