RESTApiGen


NameRESTApiGen JSON
Version 0.2.0.1 PyPI version JSON
download
home_pagehttps://github.com/Saiyam-J/RESTApiGen
SummaryREST API auto-generator.
upload_time2023-06-08 14:21:50
maintainer
docs_urlNone
authorSaiyam Jain
requires_python>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            RESTAPIGen is a tool that works with an existing SQL database and autogenerates back-end files based on the structure of the SQL. It creates Models that auto-detects the field type. Further, after creating the Models, it makes API routes for each table using the pre-generated Models. It can also use blueprints to make more modulated back-end files by
harnessing the combined power of flask-blueprint and flask-marshmallow to create APIs around the pre-generated Models. The final result is a fully-working RESTFul API which is ready to be customized. Statistically, 100% of the developers were able to create a kick-starter boilerplate API which saved several days of monotonous coding.

# Features

* Makes Models and REST files for each table so its easier to modulate and customize as per the needs.
* Integrates flask-blueprints and auto registers the models.
* Accepts requests in the form of application/json and also responds in JSON.
* Auto-detects one-to-one, one-to-many and many-to-many relationships and creates an application level soft link, even if the SQL tables are not hard indexed.
* Responds with an entire set of Collection based on the detected relationship, performs a JOIN wherever required, automatically.
* Supports all data-typed Primary Keys. Your primary keys don't necessarily have to be an integer 'id'.
* Makes the following REST APIs for each table
  * `GET` LIST : Retrieve all records from a table
  * `POST` COLLECTION : Insert a record into the table
  * `GET` GET : Retrieve a row or an entire Collection from a table
  * `PATCH` PUT : Update a row with newer data in a table
  * `DELETE` PURGE : Performs a delete operation of a row or a collection in a table

# Usage Instructions

## Requirements as a Developer
- This tool is created to facilitate development of an API for **intermediate to advanced Flask Users**.
- Beginners must learn how to create API using Flask by referring to their documentation.
- The idea of the tool was to eliminate the monotonous coding which could have been automated.
- Before beginning, you must also know how to _semantically_ create your database and establish relationships.
- The tool heavily relies on a semantic approach of how the database was created and columns were named. Example: The Primary Key of Users table does **not** have to be called `UserID`. It is just an `id`.
- Follow naming conventions and semantics. **Tables MUST always be named in Plural and Foreign Keys are always named in Singular**. Example: The JOIN should work on Users.id = Profiles.user_id
- Enjoy, and git gud!

## Installation

```
pip install restapigen
```

## Usage
To run the autogeneration script, use 
```
RESTApiGen --user <username> --database <dbname> --password <password>
RESTApiGen -u <username> -d <dbname> -p <password>
```
## List of arguments
| Argument   | Abbreviation | Usage                            |
|------------|--------------|----------------------------------|
| -\-user     | -u           | Enter the username               |
| -\-password | -p           | Enter the password               |
| -\-database | -d           | Enter the database name          |
| -\-host     | -ho          | (Optional) Enter the hostname    |
| -\-port     | -po          | (Optional) Enter the port number |
----------------------------
## List of flags
| Argument              | Usage                            |
|-----------------------|----------------------------------|
| -\-use\-blueprints  |  Makes the back-end files using flask-blueprints and flask-marshmallow        |
| -\-disbale-foreignkey |  Disables Foreign Key checker and doesnt make relations |
| -\-only-models |  Just makes the Models, nothing more

--------------------------------------

## Security Warning

- Commands entered in the terminal can be viewed, in most cases it preserves the history.
- It is highly recommended that you store the password as an environment variable and only call the environment variable.
- Since the API Generator cannot access environment variable or identify whether you entered an environment variable name or an actual password, it will consider the literal input as a password.
- **You are advised to modify the source code after generation and secure the app.**
----------------
## License
The code is distributed under MIT license. Read the licence document in the source code to know more.

----------------
## Author
Written by: [Saiyam Jain](https://github.com/Saiyam-J)
Collaborator: [Karma Dice](https://github.com/karmicdice)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Saiyam-J/RESTApiGen",
    "name": "RESTApiGen",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "",
    "author": "Saiyam Jain",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/ae/f4/6d43843676bed0f479bc06c27ed19c544c582f7b30a95c58b6204d3eb01a/RESTApiGen-0.2.0.1.tar.gz",
    "platform": null,
    "description": "RESTAPIGen is a tool that works with an existing SQL database and autogenerates back-end files based on the structure of the SQL. It creates Models that auto-detects the field type. Further, after creating the Models, it makes API routes for each table using the pre-generated Models. It can also use blueprints to make more modulated back-end files by\nharnessing the combined power of flask-blueprint and flask-marshmallow to create APIs around the pre-generated Models. The final result is a fully-working RESTFul API which is ready to be customized. Statistically, 100% of the developers were able to create a kick-starter boilerplate API which saved several days of monotonous coding.\n\n# Features\n\n* Makes Models and REST files for each table so its easier to modulate and customize as per the needs.\n* Integrates flask-blueprints and auto registers the models.\n* Accepts requests in the form of application/json and also responds in JSON.\n* Auto-detects one-to-one, one-to-many and many-to-many relationships and creates an application level soft link, even if the SQL tables are not hard indexed.\n* Responds with an entire set of Collection based on the detected relationship, performs a JOIN wherever required, automatically.\n* Supports all data-typed Primary Keys. Your primary keys don't necessarily have to be an integer 'id'.\n* Makes the following REST APIs for each table\n  * `GET` LIST : Retrieve all records from a table\n  * `POST` COLLECTION : Insert a record into the table\n  * `GET` GET : Retrieve a row or an entire Collection from a table\n  * `PATCH` PUT : Update a row with newer data in a table\n  * `DELETE` PURGE : Performs a delete operation of a row or a collection in a table\n\n# Usage Instructions\n\n## Requirements as a Developer\n- This tool is created to facilitate development of an API for **intermediate to advanced Flask Users**.\n- Beginners must learn how to create API using Flask by referring to their documentation.\n- The idea of the tool was to eliminate the monotonous coding which could have been automated.\n- Before beginning, you must also know how to _semantically_ create your database and establish relationships.\n- The tool heavily relies on a semantic approach of how the database was created and columns were named. Example: The Primary Key of Users table does **not** have to be called `UserID`. It is just an `id`.\n- Follow naming conventions and semantics. **Tables MUST always be named in Plural and Foreign Keys are always named in Singular**. Example: The JOIN should work on Users.id = Profiles.user_id\n- Enjoy, and git gud!\n\n## Installation\n\n```\npip install restapigen\n```\n\n## Usage\nTo run the autogeneration script, use \n```\nRESTApiGen --user <username> --database <dbname> --password <password>\nRESTApiGen -u <username> -d <dbname> -p <password>\n```\n## List of arguments\n| Argument   | Abbreviation | Usage                            |\n|------------|--------------|----------------------------------|\n| -\\-user     | -u           | Enter the username               |\n| -\\-password | -p           | Enter the password               |\n| -\\-database | -d           | Enter the database name          |\n| -\\-host     | -ho          | (Optional) Enter the hostname    |\n| -\\-port     | -po          | (Optional) Enter the port number |\n----------------------------\n## List of flags\n| Argument              | Usage                            |\n|-----------------------|----------------------------------|\n| -\\-use\\-blueprints  |  Makes the back-end files using flask-blueprints and flask-marshmallow        |\n| -\\-disbale-foreignkey |  Disables Foreign Key checker and doesnt make relations |\n| -\\-only-models |  Just makes the Models, nothing more\n\n--------------------------------------\n\n## Security Warning\n\n- Commands entered in the terminal can be viewed, in most cases it preserves the history.\n- It is highly recommended that you store the password as an environment variable and only call the environment variable.\n- Since the API Generator cannot access environment variable or identify whether you entered an environment variable name or an actual password, it will consider the literal input as a password.\n- **You are advised to modify the source code after generation and secure the app.**\n----------------\n## License\nThe code is distributed under MIT license. Read the licence document in the source code to know more.\n\n----------------\n## Author\nWritten by: [Saiyam Jain](https://github.com/Saiyam-J)\nCollaborator: [Karma Dice](https://github.com/karmicdice)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "REST API auto-generator.",
    "version": "0.2.0.1",
    "project_urls": {
        "Homepage": "https://github.com/Saiyam-J/RESTApiGen"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e8a337f9d82e3c72cc5730c0c888667b0f960449d67ab4a00d85f79c5428855e",
                "md5": "ad0b846ef2dab3af3fe736c9128a6026",
                "sha256": "adf6e212755f4e657250cc2e67a1c3bd3788b1a5845982da6ccbf61440c0eda7"
            },
            "downloads": -1,
            "filename": "RESTApiGen-0.2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ad0b846ef2dab3af3fe736c9128a6026",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 9235,
            "upload_time": "2023-06-08T14:21:48",
            "upload_time_iso_8601": "2023-06-08T14:21:48.120631Z",
            "url": "https://files.pythonhosted.org/packages/e8/a3/37f9d82e3c72cc5730c0c888667b0f960449d67ab4a00d85f79c5428855e/RESTApiGen-0.2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aef46d43843676bed0f479bc06c27ed19c544c582f7b30a95c58b6204d3eb01a",
                "md5": "bae5f7c11c3a42ae73c666b421a8c919",
                "sha256": "0d15dd2d8034851392c65c97e77445149fb4a49cc60e56a0c893a480c858ee13"
            },
            "downloads": -1,
            "filename": "RESTApiGen-0.2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "bae5f7c11c3a42ae73c666b421a8c919",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 8864,
            "upload_time": "2023-06-08T14:21:50",
            "upload_time_iso_8601": "2023-06-08T14:21:50.163803Z",
            "url": "https://files.pythonhosted.org/packages/ae/f4/6d43843676bed0f479bc06c27ed19c544c582f7b30a95c58b6204d3eb01a/RESTApiGen-0.2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-08 14:21:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Saiyam-J",
    "github_project": "RESTApiGen",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "restapigen"
}
        
Elapsed time: 0.20385s