ai-mock-api-generator
v1.0.2
Published
TrueSparrow Hackathon September 2023
Downloads
2
Maintainers
Readme
AI-Mock-API-Generator
TrueSparrow Hackathon September 2023 - The Stellar Showcase Winner
AI Mock API Generator
This is an NPM package that utilizes OpenAI's GPT 3.5Turbo to generate mock responses for APIs specified in OpenAPI specs. The package accepts OpenAI key and multiple OpenAPI specs in YAML or JSON format as input, and generates mock responses in JSON for the provided APIs.
Why Use This Package?
During the development phase of a backend system, it's essential to have a reliable and efficient way to test and integrate the frontend with the backend APIs. However, waiting for the backend to be fully implemented can be a bottleneck in the development process, causing delays and hindering frontend development.
This NPM package addresses this challenge by leveraging the power of OpenAI's GPT-3.5 Turbo to generate mock responses for APIs defined in OpenAPI specifications. Here's why you might want to consider using this package:
Accelerate Frontend Development
Seamless Integration: This package allows frontend developers to work on their components and interfaces without waiting for the backend to be fully implemented. It provides realistic mock data responses for specified APIs, enabling seamless integration between frontend and backend components from the early stages of development.
Faster Iterations: By using mock data generated by GPT-3.5 Turbo, frontend teams can iterate more quickly, test various scenarios, and refine their user interfaces without dependency on the backend development progress.
Minimize Bugs and Issues
Early Bug Detection: Integrating the frontend with mock API responses early in the development process helps identify potential issues and bugs sooner rather than later. This proactive approach can significantly reduce the number of bugs that might emerge during the later stages of development.
Improved Collaboration: The package facilitates collaboration between frontend and backend teams. Frontend developers can create realistic user experiences based on mock data, providing valuable feedback to backend developers, which ultimately results in a more robust and user-friendly application.
In summary, this NPM package serves as a valuable tool to bridge the gap between frontend and backend development during the initial phases of your project. It empowers frontend teams to work independently, accelerates development, and contributes to the overall quality of your application by minimizing integration challenges and reducing the likelihood of bugs in later stages.
Usage
To use the package, run the following command:
node src/index.js --open-api-specification-folder-path /path/to/openapi/specs
Set OPENAI_API_KEY
in the environment process, and provide folder path to OpenAPI specification with flag --open-api-specification-folder-path
with the path to the folder containing your OpenAPI specs.
The package will read these input values, use the OpenAI key to interact with GPT 3.5 Turbo, and provide OpenAPI spec to the AI. The AI will then generate mock responses in JSON format for the provided APIs.
Note: As of now package supports JSON formatted API Specification. You can use https://editor.swagger.io/ to make sure your OpenAPI Specification is valid.
License
This project is licensed under the MIT License.