Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

282
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!