nkowaokwu / igbo_api

An API exposing Igbo words, definitions, and more
https://igboapi.com
Apache License 2.0
316 stars 141 forks source link

Use joi to Validate Developer Body #360

Closed ijemmao closed 3 years ago

ijemmao commented 3 years ago

Is your feature request related to a problem? Please describe. Inside validateDeveloperBody.js, the API is checking each request body to ensure that it is in the right shape and includes the expected values.

Describe the solution you'd like Instead of doing schema validating by hand, the API could use joi which makes it more clear what the rules of validation for the developer body should be. Using this package also makes it easier for the Igbo API to create more rules in the future without exponentially growing in size.

Describe alternatives you've considered N/A

Additional context N/A

Japhmayor commented 3 years ago

What are the rules for validating each of the request bodies?

ijemmao commented 3 years ago

@Japhmayor We want to refactor validateDeveloperBody.js so that it's using the joi package.

More specifically, the checks that are made on the provided data and its fields (name, email, and password) should be validated with joi instead of checking each, individual field.

ijemmao commented 3 years ago

This issue has been addressed in #370