A custom wrapper over JSONSchema to validate query parameters more efficiently

alokbni


0

Votes

Description:

Problem:- When retrieving data via GET API URLs, query parameters such as page numbers, boolean values, and objects are typically passed as strings. Since there isn't a dedicated library to validate these parameters in the correct format, the challenge is to create a custom wrapper over JSONSchema that can effectively validate query parameters.

Solution:- We will develop a custom library for query parameter validation. This library will act as a specialized wrapper over JSONSchema, facilitating the validation of all query parameters. Our approach involves converting query parameters into their specific data formats; for example, treating page numbers as strings, boolean values as Booleans, and _id fields as ObjectIDs. Following this conversion process, we will compare the parameters with their expected data types. Subsequently, the transformed values will be passed to JSONSchema for validation, where we will identify any missing required fields and ensure correct data types.

Prerequisites:

  • Programming knowledge in Python
    • Knowledge of JSON
    • Familiarity with REST API development will be an added bonus

Video URL:

https://youtu.be/R5i-FeHp80M

Speaker Info:

My name is Alok Raj. I'm a passionate software developer with specific interest in REST API development in Python. I currently work as a Software Developer with BNI India pvt ltd. When not coding, I like going on bike rides, listening to music or playing cricket.

Speaker Links:

https://www.linkedin.com/in/alok-raj-139707123

Section: Core Python
Type: Talk
Target Audience: Intermediate
Last Updated: