Creating a schema for the Create User request payload

At the moment, our existing code still uses custom-defined if statements to validate the email and password fields of the Create User request payload object. Since we will be using a JSON Schema validation library for our profile object, we should also migrate our existing validation logic to a JSON Schema to remain consistent. Therefore, let's create a schema for the entire Create User request payload object.

Create a new file at src/schema/users/create.json, and insert the following schema:

{  "$schema": "http://json-schema.org/schema#",  "$id": "http://api.hobnob.social/schemas/users/create.json",  "title": "Create User Schema", "description": "For validating client-provided create user ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.