Schema Parser

Screenshot 2024-02-13 at 11 41 52

Description 📍

This tool provides a user-friendly interface powered by Django for managing JSON schemas, validating JSON responses, and generating documentation. With features for adding, updating, and validating schemas, users can efficiently work with JSON data.


Following are the project features: 📍

  1. Add Schema:
  • Allow users to add a new JSON schema to the tool.
  • Validate the added schema for correctness.
  • Provide feedback on successful addition or errors in the new schema.
  1. Create Documentation (with Internal Schema Validation):
  • Generate human-readable documentation from a selected JSON schema.
  • Internally validate the provided schema to ensure its correctness.
  • Display detailed error messages if the schema is invalid.
  • Save documentation to a file or display it on the console.
  1. Update Schema:
  • Enable users to update an existing JSON schema.
  • Validate the updated schema for correctness.
  • Allow operations such as adding, modifying, or removing properties and constraints.
  • Provide feedback on the success of the update or errors in the updated schema.

Setup 🚀

Prerequisites:

Make sure python3.9 is installed. Check the version of the python installed using

python --version

Steps to get the application running:

  1. Clone the repository:
    git clone https://github.com/prathamagrawal/SchemaParser.git
    cd SchemaParser
    
  2. Install requirements.txt
    pip install -r requirements.txt
    
  3. Change the SQL Configuration
    DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.mysql',
         'NAME':'demo',
         'USER':'demo',
         'HOST':'demo',
         'PASSWORD':'demo',
         'PORT':demo,
        }
    }
    
  4. Make Migrations:
    python manage.py makemigrations
    python manage.py migrate
    
  5. Collect the static files
    python manage.py collectstatic
    
  6. Create Superuser
    python manage.py createsuperuser
    
  7. Run the server
    python manage.py runserver
    

Usage 📍

1. Schema Creation

A user can create a schema using the add schema option. Multiple properties can be added and removed. Customizations can be made for their respective datatypes and whether they are used or not.

Creation

Screenshot 2024-02-13 at 11 50 40

View and Download Schema as json

Screenshot 2024-02-13 at 11 51 47

The following schema can be downloaded as json:

{
    "title": "employee database",
    "description": "Information of all employees",
    "properties": [
        {
            "propertyTitle": "Name",
            "propertyDescription": "Name of the employee",
            "propertyDataType": "str",
            "propertyRequired": false
        }
    ]
}

2. Validation and Creation of Readme

A user can select schema and upload a json file. The file would be validated against the json schema, if it passes it would convert it into a markdown file. If not, it would log the errors to the user.

Select Schema and Upload file

Screenshot 2024-02-13 at 11 57 35

Validation Successful

Screenshot 2024-02-13 at 12 00 42

Validation Failed

Screenshot 2024-02-13 at 12 01 08

3. Update Schema

A user can add or delete properties in a schema, and later the final updated schema can be viewed as well as download.

Add Properties

Screenshot 2024-02-13 at 12 03 50

Delete Properties

Screenshot 2024-02-13 at 12 04 41

Future works: 📍

  1. Deployment using docker
  2. Using redis cluster to make less API calls
  3. Using Sessions