Bird
0
0

You receive this validation error JSON:

medium📝 Debug Q14 of 15
Rest API - Error Handling
You receive this validation error JSON:
{"error": "Invalid input", "fields": ["email", "password"]}

What is wrong with this error detail format?
AIt correctly shows error details
BIt uses a list instead of mapping fields to messages
CIt uses wrong HTTP status code
DIt encrypts error messages
Step-by-Step Solution
Solution:
  1. Step 1: Analyze error detail format

    The "fields" key has a list of field names but no messages explaining the errors.
  2. Step 2: Identify correct format

    Validation error details should map each field to a specific error message, not just list fields.
  3. Final Answer:

    It uses a list instead of mapping fields to messages -> Option B
  4. Quick Check:

    Error details need field-message pairs [OK]
Quick Trick: Error details need field names paired with messages [OK]
Common Mistakes:
  • Listing fields without error explanations
  • Assuming any error JSON is correct
  • Ignoring the need for descriptive messages

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes