Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

289
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda