Skip to content

Commit

Permalink
Merge pull request #34 from ozkeisar/fix-swagger-import
Browse files Browse the repository at this point in the history
fix import from swagger
  • Loading branch information
ozkeisar authored Jan 3, 2025
2 parents e32861d + 623f395 commit ce1c96e
Show file tree
Hide file tree
Showing 31 changed files with 625 additions and 438 deletions.
52 changes: 25 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,51 @@

<p align="center">
<img src="https://github.com/ozkeisar/mockingbird/assets/34401842/51320104-1f8d-4734-b964-661a8882c27e" width="200" align='center' >
<p>



# Mockingbird

Mockingbird is a tool designed to help software developers test their apps without needing the real server or backend ready. Imagine you’re building a new app, but the part of the system that handles data isn’t finished yet. Instead of waiting around, you can use Mockingbird to create a pretend version of that system. This allows you to keep working and testing your app as if everything is already set up, saving time and frustration.

Mockingbird is a tool designed to help software developers test their apps without needing the real server or backend ready. Imagine you’re building a new app, but the part of the system that handles data isn’t finished yet. Instead of waiting around, you can use Mockingbird to create a pretend version of that system. This allows you to keep working and testing your app as if everything is already set up, saving time and frustration.

<p align="center">
<img src="https://github.com/user-attachments/assets/73315dfb-051b-4304-a6bb-133a0c84b057" width="750" >
<p>


## Main Features

1. **Multiple Responses for Each Route**:
1. **Multiple Responses for Each Route**:
Create different responses for the same API route, allowing you to simulate various scenarios like successful requests or errors. This helps you test how your app handles different situations.

2. **Presets**:
2. **Presets**:
Easily switch between different sets of responses with just one click. This feature allows you to test how your app behaves in various scenarios without manually changing the responses each time.

3. **Git Integration**:
3. **Git Integration**:
All mock data is stored in a Git repository, providing version control and security without the need for additional servers. You can track changes over time and collaborate more effectively.

4. **Proxy Functionality**:
4. **Proxy Functionality**:
Mockingbird can listen to actual API requests and responses, helping you quickly create mocks based on real API calls. This saves time by automating part of the setup process.

5. **API Call Monitoring**:
5. **API Call Monitoring**:
Monitor all incoming API calls to see exactly what requests are being made by your app and how they’re handled by Mockingbird.

6. **GraphQL Support**:
6. **GraphQL Support**:
Full support for creating and managing GraphQL mocks, making it easy to work with GraphQL APIs during development.

7. **Multiple Projects and Servers**:
7. **Multiple Projects and Servers**:
Manage different projects and servers within Mockingbird, making it a versatile tool for teams working on multiple applications.

8. **Built-in API for Testing**:
8. **Built-in API for Testing**:
Includes a built-in API that allows you to control Mockingbird during automated tests, helping you seamlessly integrate it into your testing workflow.

9. **Docker image**: mockingbird have a docker image that let's you set it up as part of your ci/cd, make it suitable for your e2e testing.
9. **Docker image**: mockingbird have a docker image that let's you set it up as part of your ci/cd, make it suitable for your e2e testing.

## Mockingbird Guides
## Mockingbird Guides

1. [Mockingbird: New Tool for Your Mock Environments](https://dev.to/ozkeisar/mockingbird-new-tool-for-your-mock-environments-49j)
2. [Setting Up Your Mock Server with Mockingbird](https://dev.to/ozkeisar/setting-up-your-mock-server-with-mockingbird-1b72)
3. [Mockingbird Presets: Optimizing API Development Workflows](https://dev.to/ozkeisar/optimizing-api-development-workflows-with-mockingbird-presets-17hc)
4. [Creating and Managing Multiple Projects and Servers with Mockingbird](https://dev.to/ozkeisar/creating-and-managing-multiple-projects-and-servers-with-mockingbird-a7b)
5. [I built a new way of mocking GraphQL server](https://dev.to/ozkeisar/i-built-a-new-way-of-mocking-graphql-server-i94)
6. [Dockerize Your Mockingbird Setup: A Quickstart Guide](https://dev.to/ozkeisar/how-to-use-the-mockingbird-docker-image-29mf)

6. [Dockerize Your Mockingbird Setup: A Quickstart Guide](https://dev.to/ozkeisar/how-to-use-the-mockingbird-docker-image-29mf)

## creating Docker image

Expand All @@ -61,6 +55,11 @@ Docker folder contains scripts to run the project as a standalone server.

Then use `docker build . -t {username}/mockingbird:{version}` to create the image.

`docker buildx build \
--platform linux/amd64,linux/arm64 \
-t ozkeisar/mockingbird:latest \
--push .`

## Licensing

Mockingbird is dual-licensed under the GNU Affero General Public License v3.0 (AGPLv3) for open-source use and a commercial license for proprietary use. For more details, see [LICENSE](./LICENSE) and [COMMERCIAL_LICENSE](./COMMERCIAL_LICENSE).
Expand All @@ -69,19 +68,18 @@ Mockingbird is dual-licensed under the GNU Affero General Public License v3.0 (A

We welcome contributions to Mockingbird! Please read and agree to our Contributor License Agreement (CLA) before contributing. For more details, see [CONTRIBUTING](./CONTRIBUTING.md).


## Troubleshooting

### Error - Developer Cannot be Verified (Mac Users)

- **Open terminal and Run Command:**
`xattr -c /Applications/Mockingbird.app`
- **Verify Mockingbird:**
- Once the command has been executed successfully, try running Mockingbird again.
- **Open terminal and Run Command:**

`xattr -c /Applications/Mockingbird.app`

- **Verify Mockingbird:**

- Once the command has been executed successfully, try running Mockingbird again.

For support or inquiries, contact us at [email protected]

Spread your wings with Mockingbird! 🚀

52 changes: 52 additions & 0 deletions deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mockingbird
spec:
replicas: 1
selector:
matchLabels:
app: mockingbird
template:
metadata:
labels:
app: mockingbird
spec:
containers:
- name: mockingbird
image: ozkeisar/mockingbird:latest
ports:
- containerPort: 1511
- containerPort: 3000
- containerPort: 3001
- containerPort: 3050
imagePullPolicy: Always
env:
- name: NODE_ENV
value: "production"
---
apiVersion: v1
kind: Service
metadata:
name: mockingbird-service
spec:
selector:
app: mockingbird
ports:
- name: api-port
protocol: TCP
port: 1511
targetPort: 1511
- name: web-port-3000
protocol: TCP
port: 3000
targetPort: 3000
- name: web-port-3001
protocol: TCP
port: 3001
targetPort: 3001
- name: web-port-3050
protocol: TCP
port: 3050
targetPort: 3050
type: LoadBalancer
37 changes: 33 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
"start:backend": "ts-node ./src/backend/run.ts",
"generateSwagger": "ts-node src/backend/swagger.ts",
"tsc": "tsc",
"test": "jest"
},
"browserslist": [],
Expand Down Expand Up @@ -88,6 +89,7 @@
},
"dependencies": {
"@amplitude/analytics-browser": "^2.9.3",
"@amplitude/analytics-node": "^1.3.6",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
"@monaco-editor/react": "^4.6.0",
Expand Down
80 changes: 39 additions & 41 deletions src/backend/actions/parents.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,45 @@
import { RouteParent } from "../../types";
import { EVENT_KEYS } from "../../types/events";
import { isParentExist, parentsProperties } from "../../utils/parent";
import { projectsManager } from "../managers";
import { emitGlobalSocketMessage } from "../socket";
import { hasUncommittedChanges, updateRouteParentFile } from "../utils";


export const createParent = async (projectName: string, serverName: string, parent: RouteParent)=>{

const serversHash = await projectsManager.getProjectServersHash(projectName)
const server = serversHash[serverName]

if(!server){
throw new Error("server not exist");
import { RouteParent } from '../../types';
import { EVENT_KEYS } from '../../types/events';
import { isParentExist, parentsProperties } from '../../utils/parent';
import { projectsManager } from '../managers';
import { emitGlobalSocketMessage } from '../socket';
import { updateRouteParentFile } from '../utils/files';
import { hasUncommittedChanges } from '../utils/git';

export const createParent = async (
projectName: string,
serverName: string,
parent: RouteParent,
) => {
const serversHash = await projectsManager.getProjectServersHash(projectName);
const server = serversHash[serverName];

if (!server) {
throw new Error('server not exist');
}

const {
filenames,
paths,
graphQlNames,
restPaths,
graphQlPaths
} = parentsProperties(server)


const {
parentExist,
} = isParentExist(server, {
filenames,
paths,
graphQlNames,
restPaths,
graphQlPaths
}, parent)

if(parentExist){
throw new Error("parent already exist");
const { filenames, paths, graphQlNames, restPaths, graphQlPaths } =
parentsProperties(server);

const { parentExist } = isParentExist(
server,
{
filenames,
paths,
graphQlNames,
restPaths,
graphQlPaths,
},
parent,
);

if (parentExist) {
throw new Error('parent already exist');
}

await updateRouteParentFile(projectName, serverName, parent);
projectsManager.setProjectChanged(projectName)

projectsManager.setProjectChanged(projectName);

const hasDiffs = await hasUncommittedChanges(projectName);

Expand All @@ -53,6 +52,5 @@ export const createParent = async (projectName: string, serverName: string, pare
hasDiffs,
});

return parent

}
return parent;
};
Loading

0 comments on commit ce1c96e

Please sign in to comment.