DEV Community

Cover image for Can my validation tool survive a messy retro game catalog API?
William Daugherty
William Daugherty

Posted on • Edited on

Can my validation tool survive a messy retro game catalog API?

If you’ve ever manually checked a deeply nested JSON API response at 11 PM, you know that JSON stops looking like data structures and starts looking more like ancient Sumerian.

Annoying, right?

So, I built validate_me - an API response validator that takes a JSON response and outputs a pass/fail report with flags for missing keys or incorrect types.

Let’s take a look inside this tool and highlight its most notable features.

Missing Keys Detection

To test validate_me, I generated a deeply nested (and quite messy) JSON API response with video game data in Python. I removed several required keys from the dataset, for example, games[0].platform and games[0].developer.name.

validate_me immediately flags all those missing keys, repetitive manual validation checks, making QA workflows less error-prone and more efficient.

Nested Traversal and List Indexing

What about those nested path traversals? Many APIs return deeply nested JSON responses with lists within dictionaries, making validation even trickier. Check out how validate_me handles these scenarios:

validate_me shines through its built-in list indexing support, making it easier to validate large, deeply nested JSON API responses. This feature assures the correct validation of arrays of objects, even in larger datasets.

Type Validation

Did you notice it also caught incorrect types? validate_me detects values that don't match the expected type. For example, 'release_year': "1992", where the actual value is a string "1992" instead of the expected value, an integer 1992. validate_me flags these subtle bugs before they make it into production.

Why this matters for QA

If you're a QA Engineer or Software Tester, chances are your workflow could use some streamlining. validate_me is a great way to automate the more tedious aspects of testing API responses in JSON, saving you time for other tasks.

Here’s the GitHub repo if you’d like to check it out:

https://github.com/willdata0101/validate_me

Could you see a tool like validate_me helping to streamline your QA workflows? Let me know in the comments!

Thanks!

Top comments (0)