diff --git a/README.md b/README.md index 81f2a6e..0f4d392 100644 --- a/README.md +++ b/README.md @@ -93,27 +93,298 @@ Input (Postman Collection): ```json { "info": { - "name": "Sample API", - "description": "A sample API collection" + "name": "Simple Users API", + "description": "A basic API collection for managing users", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { - "name": "Get Users", + "name": "Get All Users", "request": { "method": "GET", + "header": [], "url": { - "raw": "https://api.example.com/users", - "path": ["users"], - "query": [ + "raw": "{{baseUrl}}/api/users", + "host": ["{{baseUrl}}"], + "path": ["api", "users"] + } + }, + "response": [ + { + "name": "Success Response", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/users", + "host": ["{{baseUrl}}"], + "path": ["api", "users"] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": "{\n \"status\": \"success\",\n \"data\": [\n {\n \"id\": 1,\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"age\": 30,\n \"createdAt\": \"2024-01-01T00:00:00Z\"\n },\n {\n \"id\": 2,\n \"name\": \"Jane Smith\",\n \"email\": \"jane@example.com\",\n \"age\": 25,\n \"createdAt\": \"2024-01-02T00:00:00Z\"\n }\n ]\n}" + } + ] + }, + { + "name": "Get User by ID", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/users/1", + "host": ["{{baseUrl}}"], + "path": ["api", "users", "1"] + } + }, + "response": [ + { + "name": "Success Response", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/users/1", + "host": ["{{baseUrl}}"], + "path": ["api", "users", "1"] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ { - "key": "page", - "value": "1", - "description": "Page number" + "key": "Content-Type", + "value": "application/json" } - ] + ], + "body": "{\n \"status\": \"success\",\n \"data\": {\n \"id\": 1,\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"age\": 30,\n \"createdAt\": \"2024-01-01T00:00:00Z\"\n }\n}" }, - "description": "Get all users" - } + { + "name": "User Not Found", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/users/999", + "host": ["{{baseUrl}}"], + "path": ["api", "users", "999"] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": "{\n \"status\": \"error\",\n \"message\": \"User not found\"\n}" + } + ] + }, + { + "name": "Create User", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"age\": 30\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/api/users", + "host": ["{{baseUrl}}"], + "path": ["api", "users"] + }, + "description": "Create a new user with the provided information." + }, + "response": [ + { + "name": "Success Response", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"age\": 30\n}" + }, + "url": { + "raw": "{{baseUrl}}/api/users", + "host": ["{{baseUrl}}"], + "path": ["api", "users"] + } + }, + "status": "Created", + "code": 201, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": "{\n \"status\": \"success\",\n \"data\": {\n \"id\": 1,\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\",\n \"age\": 30,\n \"createdAt\": \"2024-01-01T00:00:00Z\"\n }\n}" + }, + { + "name": "Validation Error", + "originalRequest": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"\",\n \"email\": \"invalid-email\",\n \"age\": -1\n}" + }, + "url": { + "raw": "{{baseUrl}}/api/users", + "host": ["{{baseUrl}}"], + "path": ["api", "users"] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": "{\n \"status\": \"error\",\n \"errors\": {\n \"name\": \"Name is required\",\n \"email\": \"Invalid email format\",\n \"age\": \"Age must be a positive number\"\n }\n}" + } + ] + }, + { + "name": "Update User", + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"John Doe Updated\",\n \"email\": \"john.updated@example.com\",\n \"age\": 31\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/api/users/1", + "host": ["{{baseUrl}}"], + "path": ["api", "users", "1"] + }, + "description": "Update an existing user's information." + }, + "response": [ + { + "name": "Success Response", + "originalRequest": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"John Doe Updated\",\n \"email\": \"john.updated@example.com\",\n \"age\": 31\n}" + }, + "url": { + "raw": "{{baseUrl}}/api/users/1", + "host": ["{{baseUrl}}"], + "path": ["api", "users", "1"] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": "{\n \"status\": \"success\",\n \"data\": {\n \"id\": 1,\n \"name\": \"John Doe Updated\",\n \"email\": \"john.updated@example.com\",\n \"age\": 31,\n \"updatedAt\": \"2024-01-02T00:00:00Z\"\n }\n}" + } + ] + }, + { + "name": "Delete User", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/users/1", + "host": ["{{baseUrl}}"], + "path": ["api", "users", "1"] + } + }, + "response": [ + { + "name": "Success Response", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/users/1", + "host": ["{{baseUrl}}"], + "path": ["api", "users", "1"] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": "{\n \"status\": \"success\",\n \"message\": \"User successfully deleted\"\n}" + } + ] + } + ], + "variable": [ + { + "key": "baseUrl", + "value": "http://localhost:3000", + "type": "string" } ] } @@ -123,24 +394,143 @@ Output (OpenAPI 3.0): ```yaml openapi: 3.0.3 info: - title: Sample API - description: A sample API collection + title: Simple Users API + description: A basic API collection for managing users version: 1.0.0 + contact: {} +servers: + - url: "https://postman-echo.com" paths: - /users: + /: get: - summary: Get Users - description: Get all users - parameters: - - name: page - in: query - schema: - type: string - example: "1" - description: Page number + summary: Get User by ID + description: + operationId: get + parameters: [] + responses: + 200: + description: Success Response + content: + application/json: + schema: + type: object + example: + status: success + data: + id: 1 + name: John Doe + email: john@example.com + age: 30 + createdAt: "2024-01-01T00:00:00Z" + 404: + description: User Not Found + content: + application/json: + schema: + type: object + example: + status: error + message: User not found + post: + summary: Create User + description: Create a new user with the provided information. + operationId: post + parameters: [] responses: - '200': + 200: description: Successful response + 201: + description: Success Response + content: + application/json: + schema: + type: object + example: + status: success + data: + id: 1 + name: John Doe + email: john@example.com + age: 30 + createdAt: "2024-01-01T00:00:00Z" + 400: + description: Validation Error + content: + application/json: + schema: + type: object + example: + status: error + errors: + name: Name is required + email: Invalid email format + age: Age must be a positive number + requestBody: + required: true + content: + application/json: + schema: + type: object + example: + name: John Doe + email: john@example.com + age: 30 + put: + summary: Update User + description: Update an existing user's information. + operationId: put + parameters: [] + responses: + 200: + description: Success Response + content: + application/json: + schema: + type: object + example: + status: success + data: + id: 1 + name: John Doe Updated + email: john.updated@example.com + age: 31 + updatedAt: "2024-01-02T00:00:00Z" + requestBody: + required: true + content: + application/json: + schema: + type: object + example: + name: John Doe Updated + email: john.updated@example.com + age: 31 + delete: + summary: Delete User + description: + operationId: delete + parameters: [] + responses: + 200: + description: Success Response + content: + application/json: + schema: + type: object + example: + status: success + message: User successfully deleted +components: + schemas: {} + securitySchemes: + basicAuth: + type: http + scheme: basic + digestAuth: + type: http + scheme: digest +tags: [] + ``` ## Technical Details @@ -196,7 +586,6 @@ Contributions are welcome! Please feel free to submit a Pull Request. For major - [ ] Support for Postman Collection Format v2.1 - [ ] Handle Postman environment variables -- [ ] Add support for response examples - [ ] Implement more authentication schemes - [ ] Add batch conversion support - [ ] Add file upload/download functionality