diff --git a/__tests__/__fixtures__/postman/petstore.collection.json b/__tests__/__fixtures__/postman/petstore.collection.json new file mode 100644 index 000000000..12c42a3f1 --- /dev/null +++ b/__tests__/__fixtures__/postman/petstore.collection.json @@ -0,0 +1,2056 @@ +{ + "info": { + "_postman_id": "0b2e8577-2899-4229-bb1c-4cb031108c2f", + "name": "Swagger Petstore", + "description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.\n\nContact Support:\n Email: apiteam@swagger.io", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "pet", + "item": [ + { + "name": "{pet Id}", + "item": [ + { + "name": "Find pet by ID", + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "key", + "value": "api_key", + "type": "string" + }, + { + "key": "value", + "value": "", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/xml" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/:petId", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) ID of pet to return" + } + ] + }, + "description": "Returns a single pet" + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "GET", + "header": [ + { + "description": "Added as a part of security scheme: apikey", + "key": "api_key", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/:petId", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) ID of pet to return" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "{\n \"name\": \"doggie\",\n \"photoUrls\": [\n \"https://example.com/photo.png\",\n \"https://example.com/photo.png\"\n ],\n \"id\": 25,\n \"category\": {\n \"id\": -66648423,\n \"name\": \"sint proident voluptate nostrud\"\n },\n \"tags\": [\n {\n \"id\": -36713801,\n \"name\": \"cupidatat laboris\"\n },\n {\n \"id\": 88956444,\n \"name\": \"sed\"\n }\n ],\n \"status\": \"available\"\n}" + }, + { + "name": "Invalid ID supplied", + "originalRequest": { + "method": "GET", + "header": [ + { + "description": "Added as a part of security scheme: apikey", + "key": "api_key", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/:petId", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) ID of pet to return" + } + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + }, + { + "name": "Pet not found", + "originalRequest": { + "method": "GET", + "header": [ + { + "description": "Added as a part of security scheme: apikey", + "key": "api_key", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/:petId", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) ID of pet to return" + } + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + }, + { + "name": "successful response", + "originalRequest": { + "method": "GET", + "header": [ + { + "description": "Added as a part of security scheme: apikey", + "key": "api_key", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/:petId", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) ID of pet to return" + } + ] + } + }, + "status": "Internal Server Error", + "code": 500, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Updates a pet in the store with form data", + "request": { + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "scope", + "value": "write:pets read:pets", + "type": "string" + }, + { + "key": "authUrl", + "value": "http://petstore.swagger.io/oauth/dialog", + "type": "string" + }, + { + "key": "grant_type", + "value": "implicit", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "urlencoded", + "urlencoded": [ + { + "key": "name", + "value": "dolore magna", + "description": "Updated name of the pet" + }, + { + "key": "status", + "value": "et incididunt", + "description": "Updated status of the pet" + } + ] + }, + "url": { + "raw": "{{baseUrl}}/pet/:petId", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) ID of pet that needs to be updated" + } + ] + } + }, + "response": [ + { + "name": "Invalid input", + "originalRequest": { + "method": "POST", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + } + ], + "body": { + "mode": "urlencoded", + "urlencoded": [ + { + "key": "name", + "value": "dolore magna", + "description": "Updated name of the pet" + }, + { + "key": "status", + "value": "et incididunt", + "description": "Updated status of the pet" + } + ] + }, + "url": { + "raw": "{{baseUrl}}/pet/:petId", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) ID of pet that needs to be updated" + } + ] + } + }, + "status": "Method Not Allowed", + "code": 405, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Deletes a pet", + "request": { + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "scope", + "value": "write:pets read:pets", + "type": "string" + }, + { + "key": "authUrl", + "value": "http://petstore.swagger.io/oauth/dialog", + "type": "string" + }, + { + "key": "grant_type", + "value": "implicit", + "type": "string" + } + ] + }, + "method": "DELETE", + "header": [ + { + "key": "api_key", + "value": "dolore est" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/:petId", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) Pet id to delete" + } + ] + } + }, + "response": [ + { + "name": "Invalid ID supplied", + "originalRequest": { + "method": "DELETE", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + }, + { + "key": "api_key", + "value": "dolore est" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/:petId", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) Pet id to delete" + } + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + }, + { + "name": "Pet not found", + "originalRequest": { + "method": "DELETE", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + }, + { + "key": "api_key", + "value": "dolore est" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/:petId", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) Pet id to delete" + } + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Uploads an image", + "request": { + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "scope", + "value": "write:pets read:pets", + "type": "string" + }, + { + "key": "authUrl", + "value": "http://petstore.swagger.io/oauth/dialog", + "type": "string" + }, + { + "key": "grant_type", + "value": "implicit", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "multipart/form-data" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "additionalMetadata", + "value": "voluptate cillum", + "description": "Additional data to pass to server", + "type": "text" + }, + { + "key": "file", + "description": "file to upload", + "type": "file", + "src": [] + } + ] + }, + "url": { + "raw": "{{baseUrl}}/pet/:petId/uploadImage", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId", "uploadImage"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) ID of pet to update" + } + ] + } + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "POST", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "additionalMetadata", + "value": "voluptate cillum", + "description": "Additional data to pass to server", + "type": "text" + }, + { + "key": "file", + "description": "file to upload", + "type": "file", + "src": [] + } + ] + }, + "url": { + "raw": "{{baseUrl}}/pet/:petId/uploadImage", + "host": ["{{baseUrl}}"], + "path": ["pet", ":petId", "uploadImage"], + "variable": [ + { + "key": "petId", + "value": "-53776022", + "description": "(Required) ID of pet to update" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "{\n \"code\": -15164975,\n \"type\": \"Excepteur\",\n \"message\": \"ut Lorem dolor officia incididunt\"\n}" + } + ] + } + ] + }, + { + "name": "Add a new pet to the store", + "request": { + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "scope", + "value": "write:pets read:pets", + "type": "string" + }, + { + "key": "authUrl", + "value": "http://petstore.swagger.io/oauth/dialog", + "type": "string" + }, + { + "key": "grant_type", + "value": "implicit", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"doggie\",\n \"photoUrls\": [\n \"https://example.com/photo.png\",\n \"https://example.com/photo.png\"\n ],\n \"category\": {\n \"id\": -98206889,\n \"name\": \"ut\"\n },\n \"tags\": [\n {\n \"id\": -66696067,\n \"name\": \"laboris dolore pariatur qui\"\n },\n {\n \"id\": -22260355,\n \"name\": \"qui reprehenderit aliqua sint velit\"\n }\n ],\n \"status\": \"available\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/pet", + "host": ["{{baseUrl}}"], + "path": ["pet"] + } + }, + "response": [ + { + "name": "Invalid input", + "originalRequest": { + "method": "POST", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet", + "host": ["{{baseUrl}}"], + "path": ["pet"] + } + }, + "status": "Method Not Allowed", + "code": 405, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Update an existing pet", + "request": { + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "scope", + "value": "write:pets read:pets", + "type": "string" + }, + { + "key": "authUrl", + "value": "http://petstore.swagger.io/oauth/dialog", + "type": "string" + }, + { + "key": "grant_type", + "value": "implicit", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"doggie\",\n \"photoUrls\": [\n \"https://example.com/photo.png\",\n \"https://example.com/photo.png\"\n ],\n \"category\": {\n \"id\": 45108667,\n \"name\": \"elit\"\n },\n \"tags\": [\n {\n \"id\": -90871361,\n \"name\": \"tempor ullamco\"\n },\n {\n \"id\": 41541088,\n \"name\": \"commodo irure in dolor fugiat\"\n }\n ],\n \"status\": \"sold\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/pet", + "host": ["{{baseUrl}}"], + "path": ["pet"] + } + }, + "response": [ + { + "name": "Invalid ID supplied", + "originalRequest": { + "method": "PUT", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet", + "host": ["{{baseUrl}}"], + "path": ["pet"] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + }, + { + "name": "Pet not found", + "originalRequest": { + "method": "PUT", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet", + "host": ["{{baseUrl}}"], + "path": ["pet"] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + }, + { + "name": "Validation exception", + "originalRequest": { + "method": "PUT", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet", + "host": ["{{baseUrl}}"], + "path": ["pet"] + } + }, + "status": "Method Not Allowed", + "code": 405, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Finds Pets by status", + "request": { + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "scope", + "value": "write:pets read:pets", + "type": "string" + }, + { + "key": "authUrl", + "value": "http://petstore.swagger.io/oauth/dialog", + "type": "string" + }, + { + "key": "grant_type", + "value": "implicit", + "type": "string" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/xml" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/findByStatus?status=available&status=available", + "host": ["{{baseUrl}}"], + "path": ["pet", "findByStatus"], + "query": [ + { + "key": "status", + "value": "available", + "description": "(Required) Status values that need to be considered for filter" + }, + { + "key": "status", + "value": "available", + "description": "(Required) Status values that need to be considered for filter" + } + ] + }, + "description": "Multiple status values can be provided with comma separated strings" + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "GET", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/findByStatus?status=available&status=available", + "host": ["{{baseUrl}}"], + "path": ["pet", "findByStatus"], + "query": [ + { + "key": "status", + "value": "available" + }, + { + "key": "status", + "value": "available" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "[\n {\n \"name\": \"doggie\",\n \"photoUrls\": [\n \"https://example.com/photo.png\",\n \"https://example.com/photo.png\"\n ],\n \"id\": 25,\n \"category\": {\n \"id\": -10731015,\n \"name\": \"consectetur proident\"\n },\n \"tags\": [\n {\n \"id\": -87509155,\n \"name\": \"dolor nulla Ut\"\n },\n {\n \"id\": -19458248,\n \"name\": \"elit\"\n }\n ],\n \"status\": \"pending\"\n },\n {\n \"name\": \"doggie\",\n \"photoUrls\": [\n \"https://example.com/photo.png\",\n \"https://example.com/photo.png\"\n ],\n \"id\": 25,\n \"category\": {\n \"id\": 38511362,\n \"name\": \"a\"\n },\n \"tags\": [\n {\n \"id\": 26246913,\n \"name\": \"pariatur\"\n },\n {\n \"id\": 65442833,\n \"name\": \"dolor irure consectetur\"\n }\n ],\n \"status\": \"pending\"\n }\n]" + }, + { + "name": "Invalid status value", + "originalRequest": { + "method": "GET", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/findByStatus?status=available&status=available", + "host": ["{{baseUrl}}"], + "path": ["pet", "findByStatus"], + "query": [ + { + "key": "status", + "value": "available" + }, + { + "key": "status", + "value": "available" + } + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Finds Pets by tags", + "request": { + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "scope", + "value": "write:pets read:pets", + "type": "string" + }, + { + "key": "authUrl", + "value": "http://petstore.swagger.io/oauth/dialog", + "type": "string" + }, + { + "key": "grant_type", + "value": "implicit", + "type": "string" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/xml" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/findByTags?tags=enim nostrud consequat&tags=culpa quis dolor laboris", + "host": ["{{baseUrl}}"], + "path": ["pet", "findByTags"], + "query": [ + { + "key": "tags", + "value": "enim nostrud consequat", + "description": "(Required) Tags to filter by" + }, + { + "key": "tags", + "value": "culpa quis dolor laboris", + "description": "(Required) Tags to filter by" + } + ] + }, + "description": "Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "GET", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/findByTags?tags=sed occaecat anim veniam ex&tags=anim reprehenderit magna", + "host": ["{{baseUrl}}"], + "path": ["pet", "findByTags"], + "query": [ + { + "key": "tags", + "value": "sed occaecat anim veniam ex" + }, + { + "key": "tags", + "value": "anim reprehenderit magna" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "[\n {\n \"name\": \"doggie\",\n \"photoUrls\": [\n \"https://example.com/photo.png\",\n \"https://example.com/photo.png\"\n ],\n \"id\": 25,\n \"category\": {\n \"id\": -10731015,\n \"name\": \"consectetur proident\"\n },\n \"tags\": [\n {\n \"id\": -87509155,\n \"name\": \"dolor nulla Ut\"\n },\n {\n \"id\": -19458248,\n \"name\": \"elit\"\n }\n ],\n \"status\": \"pending\"\n },\n {\n \"name\": \"doggie\",\n \"photoUrls\": [\n \"https://example.com/photo.png\",\n \"https://example.com/photo.png\"\n ],\n \"id\": 25,\n \"category\": {\n \"id\": 38511362,\n \"name\": \"a\"\n },\n \"tags\": [\n {\n \"id\": 26246913,\n \"name\": \"pariatur\"\n },\n {\n \"id\": 65442833,\n \"name\": \"dolor irure consectetur\"\n }\n ],\n \"status\": \"pending\"\n }\n]" + }, + { + "name": "Invalid tag value", + "originalRequest": { + "method": "GET", + "header": [ + { + "description": "Added as a part of security scheme: oauth2", + "key": "Authorization", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/pet/findByTags?tags=sed occaecat anim veniam ex&tags=anim reprehenderit magna", + "host": ["{{baseUrl}}"], + "path": ["pet", "findByTags"], + "query": [ + { + "key": "tags", + "value": "sed occaecat anim veniam ex" + }, + { + "key": "tags", + "value": "anim reprehenderit magna" + } + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + } + ] + }, + { + "name": "store", + "item": [ + { + "name": "order", + "item": [ + { + "name": "{order Id}", + "item": [ + { + "name": "Find purchase order by ID", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/xml" + } + ], + "url": { + "raw": "{{baseUrl}}/store/order/:orderId", + "host": ["{{baseUrl}}"], + "path": ["store", "order", ":orderId"], + "variable": [ + { + "key": "orderId", + "value": "7", + "description": "(Required) ID of pet that needs to be fetched" + } + ] + }, + "description": "For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions" + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/store/order/:orderId", + "host": ["{{baseUrl}}"], + "path": ["store", "order", ":orderId"], + "variable": [ + { + "key": "orderId", + "value": "7", + "description": "(Required) ID of pet that needs to be fetched" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "{\n \"id\": -15329310,\n \"petId\": -50620843,\n \"quantity\": 78361352,\n \"shipDate\": \"2018-08-08T02:36:45.934Z\",\n \"status\": \"delivered\",\n \"complete\": false\n}" + }, + { + "name": "Invalid ID supplied", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/store/order/:orderId", + "host": ["{{baseUrl}}"], + "path": ["store", "order", ":orderId"], + "variable": [ + { + "key": "orderId", + "value": "7", + "description": "(Required) ID of pet that needs to be fetched" + } + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + }, + { + "name": "Order not found", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/store/order/:orderId", + "host": ["{{baseUrl}}"], + "path": ["store", "order", ":orderId"], + "variable": [ + { + "key": "orderId", + "value": "7", + "description": "(Required) ID of pet that needs to be fetched" + } + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Delete purchase order by ID", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/store/order/:orderId", + "host": ["{{baseUrl}}"], + "path": ["store", "order", ":orderId"], + "variable": [ + { + "key": "orderId", + "value": "32526146", + "description": "(Required) ID of the order that needs to be deleted" + } + ] + }, + "description": "For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors" + }, + "response": [ + { + "name": "Invalid ID supplied", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/store/order/:orderId", + "host": ["{{baseUrl}}"], + "path": ["store", "order", ":orderId"], + "variable": [ + { + "key": "orderId", + "value": "32526146", + "description": "(Required) ID of the order that needs to be deleted" + } + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + }, + { + "name": "Order not found", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/store/order/:orderId", + "host": ["{{baseUrl}}"], + "path": ["store", "order", ":orderId"], + "variable": [ + { + "key": "orderId", + "value": "32526146", + "description": "(Required) ID of the order that needs to be deleted" + } + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + } + ] + }, + { + "name": "Place an order for a pet", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Accept", + "value": "application/xml" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"id\": -15329310,\n \"petId\": -50620843,\n \"quantity\": 78361352,\n \"shipDate\": \"2018-08-08T02:36:45.934Z\",\n \"status\": \"delivered\",\n \"complete\": false\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/store/order", + "host": ["{{baseUrl}}"], + "path": ["store", "order"] + } + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": -15329310,\n \"petId\": -50620843,\n \"quantity\": 78361352,\n \"shipDate\": \"2018-08-08T02:36:45.934Z\",\n \"status\": \"delivered\",\n \"complete\": false\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/store/order", + "host": ["{{baseUrl}}"], + "path": ["store", "order"] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "{\n \"id\": -15329310,\n \"petId\": -50620843,\n \"quantity\": 78361352,\n \"shipDate\": \"2018-08-08T02:36:45.934Z\",\n \"status\": \"delivered\",\n \"complete\": false\n}" + }, + { + "name": "Invalid Order", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": -15329310,\n \"petId\": -50620843,\n \"quantity\": 78361352,\n \"shipDate\": \"2018-08-08T02:36:45.934Z\",\n \"status\": \"delivered\",\n \"complete\": false\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/store/order", + "host": ["{{baseUrl}}"], + "path": ["store", "order"] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + } + ] + }, + { + "name": "Returns pet inventories by status", + "request": { + "auth": { + "type": "apikey", + "apikey": [ + { + "key": "key", + "value": "api_key", + "type": "string" + }, + { + "key": "value", + "value": "", + "type": "string" + }, + { + "key": "in", + "value": "header", + "type": "string" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "url": { + "raw": "{{baseUrl}}/store/inventory", + "host": ["{{baseUrl}}"], + "path": ["store", "inventory"] + }, + "description": "Returns a map of status codes to quantities" + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "GET", + "header": [ + { + "description": "Added as a part of security scheme: apikey", + "key": "api_key", + "value": "" + } + ], + "url": { + "raw": "{{baseUrl}}/store/inventory", + "host": ["{{baseUrl}}"], + "path": ["store", "inventory"] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "{\n \"dolor_4\": -59651882,\n \"dolor__10\": 76938793\n}" + } + ] + } + ] + }, + { + "name": "user", + "item": [ + { + "name": "{username}", + "item": [ + { + "name": "Get user by user name", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/xml" + } + ], + "url": { + "raw": "{{baseUrl}}/user/:username", + "host": ["{{baseUrl}}"], + "path": ["user", ":username"], + "variable": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) The name that needs to be fetched. Use user1 for testing. " + } + ] + } + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/:username", + "host": ["{{baseUrl}}"], + "path": ["user", ":username"], + "variable": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) The name that needs to be fetched. Use user1 for testing. " + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "{\n \"id\": -70409270,\n \"username\": \"do ea nisi\",\n \"firstName\": \"occaecat dolor in dolore\",\n \"lastName\": \"laborum sit ullamco\",\n \"email\": \"nostrud Ut\",\n \"password\": \"officia occaecat enim l\",\n \"phone\": \"in elit officia sint\",\n \"userStatus\": 86291576\n}" + }, + { + "name": "Invalid username supplied", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/:username", + "host": ["{{baseUrl}}"], + "path": ["user", ":username"], + "variable": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) The name that needs to be fetched. Use user1 for testing. " + } + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + }, + { + "name": "User not found", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/:username", + "host": ["{{baseUrl}}"], + "path": ["user", ":username"], + "variable": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) The name that needs to be fetched. Use user1 for testing. " + } + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Updated user", + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"id\": -70409270,\n \"username\": \"do ea nisi\",\n \"firstName\": \"occaecat dolor in dolore\",\n \"lastName\": \"laborum sit ullamco\",\n \"email\": \"nostrud Ut\",\n \"password\": \"officia occaecat enim l\",\n \"phone\": \"in elit officia sint\",\n \"userStatus\": 86291576\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/user/:username", + "host": ["{{baseUrl}}"], + "path": ["user", ":username"], + "variable": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) name that need to be updated" + } + ] + }, + "description": "This can only be done by the logged in user." + }, + "response": [ + { + "name": "Invalid user supplied", + "originalRequest": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": -70409270,\n \"username\": \"do ea nisi\",\n \"firstName\": \"occaecat dolor in dolore\",\n \"lastName\": \"laborum sit ullamco\",\n \"email\": \"nostrud Ut\",\n \"password\": \"officia occaecat enim l\",\n \"phone\": \"in elit officia sint\",\n \"userStatus\": 86291576\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/user/:username", + "host": ["{{baseUrl}}"], + "path": ["user", ":username"], + "variable": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) name that need to be updated" + } + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + }, + { + "name": "User not found", + "originalRequest": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": -70409270,\n \"username\": \"do ea nisi\",\n \"firstName\": \"occaecat dolor in dolore\",\n \"lastName\": \"laborum sit ullamco\",\n \"email\": \"nostrud Ut\",\n \"password\": \"officia occaecat enim l\",\n \"phone\": \"in elit officia sint\",\n \"userStatus\": 86291576\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/user/:username", + "host": ["{{baseUrl}}"], + "path": ["user", ":username"], + "variable": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) name that need to be updated" + } + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Delete user", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/:username", + "host": ["{{baseUrl}}"], + "path": ["user", ":username"], + "variable": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) The name that needs to be deleted" + } + ] + }, + "description": "This can only be done by the logged in user." + }, + "response": [ + { + "name": "Invalid username supplied", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/:username", + "host": ["{{baseUrl}}"], + "path": ["user", ":username"], + "variable": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) The name that needs to be deleted" + } + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + }, + { + "name": "User not found", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/:username", + "host": ["{{baseUrl}}"], + "path": ["user", ":username"], + "variable": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) The name that needs to be deleted" + } + ] + } + }, + "status": "Not Found", + "code": 404, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + } + ] + }, + { + "name": "Create user", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"id\": -70409270,\n \"username\": \"do ea nisi\",\n \"firstName\": \"occaecat dolor in dolore\",\n \"lastName\": \"laborum sit ullamco\",\n \"email\": \"nostrud Ut\",\n \"password\": \"officia occaecat enim l\",\n \"phone\": \"in elit officia sint\",\n \"userStatus\": 86291576\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/user", + "host": ["{{baseUrl}}"], + "path": ["user"] + }, + "description": "This can only be done by the logged in user." + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": -70409270,\n \"username\": \"do ea nisi\",\n \"firstName\": \"occaecat dolor in dolore\",\n \"lastName\": \"laborum sit ullamco\",\n \"email\": \"nostrud Ut\",\n \"password\": \"officia occaecat enim l\",\n \"phone\": \"in elit officia sint\",\n \"userStatus\": 86291576\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/user", + "host": ["{{baseUrl}}"], + "path": ["user"] + } + }, + "status": "Internal Server Error", + "code": 500, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Creates list of users with given input array", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "[\n {\n \"id\": -95496632,\n \"username\": \"reprehenderit Duis\",\n \"firstName\": \"ipsum enim\",\n \"lastName\": \"sit incididunt quis su\",\n \"email\": \"esse in nostrud\",\n \"password\": \"dolore\",\n \"phone\": \"ea tempor sed eiusmod\",\n \"userStatus\": 23456761\n },\n {\n \"id\": -17610454,\n \"username\": \"occaecat in laboris voluptate\",\n \"firstName\": \"consectetur fugiat\",\n \"lastName\": \"est consectet\",\n \"email\": \"ea qui\",\n \"password\": \"dolor aliquip\",\n \"phone\": \"nulla eu veniam\",\n \"userStatus\": -56036685\n }\n]", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/user/createWithArray", + "host": ["{{baseUrl}}"], + "path": ["user", "createWithArray"] + } + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "POST", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/createWithArray", + "host": ["{{baseUrl}}"], + "path": ["user", "createWithArray"] + } + }, + "status": "Internal Server Error", + "code": 500, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Creates list of users with given input array", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "[\n {\n \"id\": -17453134,\n \"username\": \"est veniam proident\",\n \"firstName\": \"adipisic\",\n \"lastName\": \"ea nisi ut anim\",\n \"email\": \"culpa voluptate laborum ut\",\n \"password\": \"veniam id enim voluptate\",\n \"phone\": \"enim sed\",\n \"userStatus\": 31329378\n },\n {\n \"id\": -97425969,\n \"username\": \"velit sint ea ad reprehend\",\n \"firstName\": \"reprehenderit do aliquip\",\n \"lastName\": \"anim mollit\",\n \"email\": \"minim qui laborum in\",\n \"password\": \"exercitation quis\",\n \"phone\": \"irure\",\n \"userStatus\": -62781043\n }\n]", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/user/createWithList", + "host": ["{{baseUrl}}"], + "path": ["user", "createWithList"] + } + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "POST", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/createWithList", + "host": ["{{baseUrl}}"], + "path": ["user", "createWithList"] + } + }, + "status": "Internal Server Error", + "code": 500, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Logs user into the system", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/xml" + } + ], + "url": { + "raw": "{{baseUrl}}/user/login?username=dolore est&password=dolore est", + "host": ["{{baseUrl}}"], + "path": ["user", "login"], + "query": [ + { + "key": "username", + "value": "dolore est", + "description": "(Required) The user name for login" + }, + { + "key": "password", + "value": "dolore est", + "description": "(Required) The password for login in clear text" + } + ] + } + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/login?username=dolore est&password=dolore est", + "host": ["{{baseUrl}}"], + "path": ["user", "login"], + "query": [ + { + "key": "username", + "value": "dolore est" + }, + { + "key": "password", + "value": "dolore est" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Rate-Limit", + "value": "-71676539", + "description": "calls per hour allowed by the user" + }, + { + "key": "X-Expires-After", + "value": "1966-01-28T06:32:02.771Z", + "description": "date in UTC when token expires" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "cookie": [], + "body": "\"dolore est\"" + }, + { + "name": "Invalid username/password supplied", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/login?username=dolore est&password=dolore est", + "host": ["{{baseUrl}}"], + "path": ["user", "login"], + "query": [ + { + "key": "username", + "value": "dolore est" + }, + { + "key": "password", + "value": "dolore est" + } + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + }, + { + "name": "Logs out current logged in user session", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/logout", + "host": ["{{baseUrl}}"], + "path": ["user", "logout"] + } + }, + "response": [ + { + "name": "successful operation", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/user/logout", + "host": ["{{baseUrl}}"], + "path": ["user", "logout"] + } + }, + "status": "Internal Server Error", + "code": 500, + "_postman_previewlanguage": "text", + "header": [ + { + "key": "Content-Type", + "value": "text/plain" + } + ], + "cookie": [], + "body": "" + } + ] + } + ] + } + ], + "variable": [ + { + "key": "baseUrl", + "value": "http://petstore.swagger.io/v2", + "type": "string" + } + ] +} diff --git a/__tests__/__fixtures__/postman/petstore.collection.yaml b/__tests__/__fixtures__/postman/petstore.collection.yaml new file mode 100644 index 000000000..05bf5a906 --- /dev/null +++ b/__tests__/__fixtures__/postman/petstore.collection.yaml @@ -0,0 +1,1793 @@ +info: + _postman_id: 0b2e8577-2899-4229-bb1c-4cb031108c2f + name: Swagger Petstore + description: |- + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + Contact Support: + Email: apiteam@swagger.io + schema: https://schema.getpostman.com/json/collection/v2.1.0/collection.json +item: + - name: pet + item: + - name: '{pet Id}' + item: + - name: Find pet by ID + request: + auth: + type: apikey + apikey: + - key: key + value: api_key + type: string + - key: value + value: '' + type: string + - key: in + value: header + type: string + method: GET + header: + - key: Accept + value: application/xml + url: + raw: '{{baseUrl}}/pet/:petId' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + variable: + - key: petId + value: '-53776022' + description: '(Required) ID of pet to return' + description: Returns a single pet + response: + - name: successful operation + originalRequest: + method: GET + header: + - description: 'Added as a part of security scheme: apikey' + key: api_key + value: '' + url: + raw: '{{baseUrl}}/pet/:petId' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + variable: + - key: petId + value: '-53776022' + description: '(Required) ID of pet to return' + status: OK + code: 200 + _postman_previewlanguage: json + header: + - key: Content-Type + value: application/json + cookie: [] + body: |- + { + "name": "doggie", + "photoUrls": [ + "https://example.com/photo.png", + "https://example.com/photo.png" + ], + "id": 25, + "category": { + "id": -66648423, + "name": "sint proident voluptate nostrud" + }, + "tags": [ + { + "id": -36713801, + "name": "cupidatat laboris" + }, + { + "id": 88956444, + "name": "sed" + } + ], + "status": "available" + } + - name: Invalid ID supplied + originalRequest: + method: GET + header: + - description: 'Added as a part of security scheme: apikey' + key: api_key + value: '' + url: + raw: '{{baseUrl}}/pet/:petId' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + variable: + - key: petId + value: '-53776022' + description: '(Required) ID of pet to return' + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Pet not found + originalRequest: + method: GET + header: + - description: 'Added as a part of security scheme: apikey' + key: api_key + value: '' + url: + raw: '{{baseUrl}}/pet/:petId' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + variable: + - key: petId + value: '-53776022' + description: '(Required) ID of pet to return' + status: Not Found + code: 404 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: successful response + originalRequest: + method: GET + header: + - description: 'Added as a part of security scheme: apikey' + key: api_key + value: '' + url: + raw: '{{baseUrl}}/pet/:petId' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + variable: + - key: petId + value: '-53776022' + description: '(Required) ID of pet to return' + status: Internal Server Error + code: 500 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Updates a pet in the store with form data + request: + auth: + type: oauth2 + oauth2: + - key: scope + value: write:pets read:pets + type: string + - key: authUrl + value: http://petstore.swagger.io/oauth/dialog + type: string + - key: grant_type + value: implicit + type: string + method: POST + header: + - key: Content-Type + value: application/x-www-form-urlencoded + body: + mode: urlencoded + urlencoded: + - key: name + value: dolore magna + description: Updated name of the pet + - key: status + value: et incididunt + description: Updated status of the pet + url: + raw: '{{baseUrl}}/pet/:petId' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + variable: + - key: petId + value: '-53776022' + description: '(Required) ID of pet that needs to be updated' + response: + - name: Invalid input + originalRequest: + method: POST + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + body: + mode: urlencoded + urlencoded: + - key: name + value: dolore magna + description: Updated name of the pet + - key: status + value: et incididunt + description: Updated status of the pet + url: + raw: '{{baseUrl}}/pet/:petId' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + variable: + - key: petId + value: '-53776022' + description: '(Required) ID of pet that needs to be updated' + status: Method Not Allowed + code: 405 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Deletes a pet + request: + auth: + type: oauth2 + oauth2: + - key: scope + value: write:pets read:pets + type: string + - key: authUrl + value: http://petstore.swagger.io/oauth/dialog + type: string + - key: grant_type + value: implicit + type: string + method: DELETE + header: + - key: api_key + value: dolore est + url: + raw: '{{baseUrl}}/pet/:petId' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + variable: + - key: petId + value: '-53776022' + description: '(Required) Pet id to delete' + response: + - name: Invalid ID supplied + originalRequest: + method: DELETE + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + - key: api_key + value: dolore est + url: + raw: '{{baseUrl}}/pet/:petId' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + variable: + - key: petId + value: '-53776022' + description: '(Required) Pet id to delete' + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Pet not found + originalRequest: + method: DELETE + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + - key: api_key + value: dolore est + url: + raw: '{{baseUrl}}/pet/:petId' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + variable: + - key: petId + value: '-53776022' + description: '(Required) Pet id to delete' + status: Not Found + code: 404 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Uploads an image + request: + auth: + type: oauth2 + oauth2: + - key: scope + value: write:pets read:pets + type: string + - key: authUrl + value: http://petstore.swagger.io/oauth/dialog + type: string + - key: grant_type + value: implicit + type: string + method: POST + header: + - key: Content-Type + value: multipart/form-data + - key: Accept + value: application/json + body: + mode: formdata + formdata: + - key: additionalMetadata + value: voluptate cillum + description: Additional data to pass to server + type: text + - key: file + description: file to upload + type: file + src: [] + url: + raw: '{{baseUrl}}/pet/:petId/uploadImage' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + - uploadImage + variable: + - key: petId + value: '-53776022' + description: '(Required) ID of pet to update' + response: + - name: successful operation + originalRequest: + method: POST + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + body: + mode: formdata + formdata: + - key: additionalMetadata + value: voluptate cillum + description: Additional data to pass to server + type: text + - key: file + description: file to upload + type: file + src: [] + url: + raw: '{{baseUrl}}/pet/:petId/uploadImage' + host: + - '{{baseUrl}}' + path: + - pet + - ':petId' + - uploadImage + variable: + - key: petId + value: '-53776022' + description: '(Required) ID of pet to update' + status: OK + code: 200 + _postman_previewlanguage: json + header: + - key: Content-Type + value: application/json + cookie: [] + body: |- + { + "code": -15164975, + "type": "Excepteur", + "message": "ut Lorem dolor officia incididunt" + } + - name: Add a new pet to the store + request: + auth: + type: oauth2 + oauth2: + - key: scope + value: write:pets read:pets + type: string + - key: authUrl + value: http://petstore.swagger.io/oauth/dialog + type: string + - key: grant_type + value: implicit + type: string + method: POST + header: + - key: Content-Type + value: application/json + body: + mode: raw + raw: |- + { + "name": "doggie", + "photoUrls": [ + "https://example.com/photo.png", + "https://example.com/photo.png" + ], + "category": { + "id": -98206889, + "name": "ut" + }, + "tags": [ + { + "id": -66696067, + "name": "laboris dolore pariatur qui" + }, + { + "id": -22260355, + "name": "qui reprehenderit aliqua sint velit" + } + ], + "status": "available" + } + options: + raw: + language: json + url: + raw: '{{baseUrl}}/pet' + host: + - '{{baseUrl}}' + path: + - pet + response: + - name: Invalid input + originalRequest: + method: POST + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + url: + raw: '{{baseUrl}}/pet' + host: + - '{{baseUrl}}' + path: + - pet + status: Method Not Allowed + code: 405 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Update an existing pet + request: + auth: + type: oauth2 + oauth2: + - key: scope + value: write:pets read:pets + type: string + - key: authUrl + value: http://petstore.swagger.io/oauth/dialog + type: string + - key: grant_type + value: implicit + type: string + method: PUT + header: + - key: Content-Type + value: application/json + body: + mode: raw + raw: |- + { + "name": "doggie", + "photoUrls": [ + "https://example.com/photo.png", + "https://example.com/photo.png" + ], + "category": { + "id": 45108667, + "name": "elit" + }, + "tags": [ + { + "id": -90871361, + "name": "tempor ullamco" + }, + { + "id": 41541088, + "name": "commodo irure in dolor fugiat" + } + ], + "status": "sold" + } + options: + raw: + language: json + url: + raw: '{{baseUrl}}/pet' + host: + - '{{baseUrl}}' + path: + - pet + response: + - name: Invalid ID supplied + originalRequest: + method: PUT + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + url: + raw: '{{baseUrl}}/pet' + host: + - '{{baseUrl}}' + path: + - pet + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Pet not found + originalRequest: + method: PUT + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + url: + raw: '{{baseUrl}}/pet' + host: + - '{{baseUrl}}' + path: + - pet + status: Not Found + code: 404 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Validation exception + originalRequest: + method: PUT + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + url: + raw: '{{baseUrl}}/pet' + host: + - '{{baseUrl}}' + path: + - pet + status: Method Not Allowed + code: 405 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Finds Pets by status + request: + auth: + type: oauth2 + oauth2: + - key: scope + value: write:pets read:pets + type: string + - key: authUrl + value: http://petstore.swagger.io/oauth/dialog + type: string + - key: grant_type + value: implicit + type: string + method: GET + header: + - key: Accept + value: application/xml + url: + raw: '{{baseUrl}}/pet/findByStatus?status=available&status=available' + host: + - '{{baseUrl}}' + path: + - pet + - findByStatus + query: + - key: status + value: available + description: '(Required) Status values that need to be considered for filter' + - key: status + value: available + description: '(Required) Status values that need to be considered for filter' + description: Multiple status values can be provided with comma separated strings + response: + - name: successful operation + originalRequest: + method: GET + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + url: + raw: '{{baseUrl}}/pet/findByStatus?status=available&status=available' + host: + - '{{baseUrl}}' + path: + - pet + - findByStatus + query: + - key: status + value: available + - key: status + value: available + status: OK + code: 200 + _postman_previewlanguage: json + header: + - key: Content-Type + value: application/json + cookie: [] + body: |- + [ + { + "name": "doggie", + "photoUrls": [ + "https://example.com/photo.png", + "https://example.com/photo.png" + ], + "id": 25, + "category": { + "id": -10731015, + "name": "consectetur proident" + }, + "tags": [ + { + "id": -87509155, + "name": "dolor nulla Ut" + }, + { + "id": -19458248, + "name": "elit" + } + ], + "status": "pending" + }, + { + "name": "doggie", + "photoUrls": [ + "https://example.com/photo.png", + "https://example.com/photo.png" + ], + "id": 25, + "category": { + "id": 38511362, + "name": "a" + }, + "tags": [ + { + "id": 26246913, + "name": "pariatur" + }, + { + "id": 65442833, + "name": "dolor irure consectetur" + } + ], + "status": "pending" + } + ] + - name: Invalid status value + originalRequest: + method: GET + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + url: + raw: '{{baseUrl}}/pet/findByStatus?status=available&status=available' + host: + - '{{baseUrl}}' + path: + - pet + - findByStatus + query: + - key: status + value: available + - key: status + value: available + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Finds Pets by tags + request: + auth: + type: oauth2 + oauth2: + - key: scope + value: write:pets read:pets + type: string + - key: authUrl + value: http://petstore.swagger.io/oauth/dialog + type: string + - key: grant_type + value: implicit + type: string + method: GET + header: + - key: Accept + value: application/xml + url: + raw: '{{baseUrl}}/pet/findByTags?tags=enim nostrud consequat&tags=culpa quis + dolor laboris' + host: + - '{{baseUrl}}' + path: + - pet + - findByTags + query: + - key: tags + value: enim nostrud consequat + description: '(Required) Tags to filter by' + - key: tags + value: culpa quis dolor laboris + description: '(Required) Tags to filter by' + description: Muliple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + response: + - name: successful operation + originalRequest: + method: GET + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + url: + raw: '{{baseUrl}}/pet/findByTags?tags=sed occaecat anim veniam ex&tags=anim + reprehenderit magna' + host: + - '{{baseUrl}}' + path: + - pet + - findByTags + query: + - key: tags + value: sed occaecat anim veniam ex + - key: tags + value: anim reprehenderit magna + status: OK + code: 200 + _postman_previewlanguage: json + header: + - key: Content-Type + value: application/json + cookie: [] + body: |- + [ + { + "name": "doggie", + "photoUrls": [ + "https://example.com/photo.png", + "https://example.com/photo.png" + ], + "id": 25, + "category": { + "id": -10731015, + "name": "consectetur proident" + }, + "tags": [ + { + "id": -87509155, + "name": "dolor nulla Ut" + }, + { + "id": -19458248, + "name": "elit" + } + ], + "status": "pending" + }, + { + "name": "doggie", + "photoUrls": [ + "https://example.com/photo.png", + "https://example.com/photo.png" + ], + "id": 25, + "category": { + "id": 38511362, + "name": "a" + }, + "tags": [ + { + "id": 26246913, + "name": "pariatur" + }, + { + "id": 65442833, + "name": "dolor irure consectetur" + } + ], + "status": "pending" + } + ] + - name: Invalid tag value + originalRequest: + method: GET + header: + - description: 'Added as a part of security scheme: oauth2' + key: Authorization + value: '' + url: + raw: '{{baseUrl}}/pet/findByTags?tags=sed occaecat anim veniam ex&tags=anim + reprehenderit magna' + host: + - '{{baseUrl}}' + path: + - pet + - findByTags + query: + - key: tags + value: sed occaecat anim veniam ex + - key: tags + value: anim reprehenderit magna + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: store + item: + - name: order + item: + - name: '{order Id}' + item: + - name: Find purchase order by ID + request: + method: GET + header: + - key: Accept + value: application/xml + url: + raw: '{{baseUrl}}/store/order/:orderId' + host: + - '{{baseUrl}}' + path: + - store + - order + - ':orderId' + variable: + - key: orderId + value: '7' + description: '(Required) ID of pet that needs to be fetched' + description: For valid response try integer IDs with value >= 1 and <= 10. + Other values will generated exceptions + response: + - name: successful operation + originalRequest: + method: GET + header: [] + url: + raw: '{{baseUrl}}/store/order/:orderId' + host: + - '{{baseUrl}}' + path: + - store + - order + - ':orderId' + variable: + - key: orderId + value: '7' + description: '(Required) ID of pet that needs to be fetched' + status: OK + code: 200 + _postman_previewlanguage: json + header: + - key: Content-Type + value: application/json + cookie: [] + body: |- + { + "id": -15329310, + "petId": -50620843, + "quantity": 78361352, + "shipDate": "2018-08-08T02:36:45.934Z", + "status": "delivered", + "complete": false + } + - name: Invalid ID supplied + originalRequest: + method: GET + header: [] + url: + raw: '{{baseUrl}}/store/order/:orderId' + host: + - '{{baseUrl}}' + path: + - store + - order + - ':orderId' + variable: + - key: orderId + value: '7' + description: '(Required) ID of pet that needs to be fetched' + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Order not found + originalRequest: + method: GET + header: [] + url: + raw: '{{baseUrl}}/store/order/:orderId' + host: + - '{{baseUrl}}' + path: + - store + - order + - ':orderId' + variable: + - key: orderId + value: '7' + description: '(Required) ID of pet that needs to be fetched' + status: Not Found + code: 404 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Delete purchase order by ID + request: + method: DELETE + header: [] + url: + raw: '{{baseUrl}}/store/order/:orderId' + host: + - '{{baseUrl}}' + path: + - store + - order + - ':orderId' + variable: + - key: orderId + value: '32526146' + description: '(Required) ID of the order that needs to be deleted' + description: For valid response try integer IDs with positive integer value. + Negative or non-integer values will generate API errors + response: + - name: Invalid ID supplied + originalRequest: + method: DELETE + header: [] + url: + raw: '{{baseUrl}}/store/order/:orderId' + host: + - '{{baseUrl}}' + path: + - store + - order + - ':orderId' + variable: + - key: orderId + value: '32526146' + description: '(Required) ID of the order that needs to be deleted' + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Order not found + originalRequest: + method: DELETE + header: [] + url: + raw: '{{baseUrl}}/store/order/:orderId' + host: + - '{{baseUrl}}' + path: + - store + - order + - ':orderId' + variable: + - key: orderId + value: '32526146' + description: '(Required) ID of the order that needs to be deleted' + status: Not Found + code: 404 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Place an order for a pet + request: + method: POST + header: + - key: Content-Type + value: application/json + - key: Accept + value: application/xml + body: + mode: raw + raw: |- + { + "id": -15329310, + "petId": -50620843, + "quantity": 78361352, + "shipDate": "2018-08-08T02:36:45.934Z", + "status": "delivered", + "complete": false + } + options: + raw: + language: json + url: + raw: '{{baseUrl}}/store/order' + host: + - '{{baseUrl}}' + path: + - store + - order + response: + - name: successful operation + originalRequest: + method: POST + header: [] + body: + mode: raw + raw: |- + { + "id": -15329310, + "petId": -50620843, + "quantity": 78361352, + "shipDate": "2018-08-08T02:36:45.934Z", + "status": "delivered", + "complete": false + } + options: + raw: + language: json + url: + raw: '{{baseUrl}}/store/order' + host: + - '{{baseUrl}}' + path: + - store + - order + status: OK + code: 200 + _postman_previewlanguage: json + header: + - key: Content-Type + value: application/json + cookie: [] + body: |- + { + "id": -15329310, + "petId": -50620843, + "quantity": 78361352, + "shipDate": "2018-08-08T02:36:45.934Z", + "status": "delivered", + "complete": false + } + - name: Invalid Order + originalRequest: + method: POST + header: [] + body: + mode: raw + raw: |- + { + "id": -15329310, + "petId": -50620843, + "quantity": 78361352, + "shipDate": "2018-08-08T02:36:45.934Z", + "status": "delivered", + "complete": false + } + options: + raw: + language: json + url: + raw: '{{baseUrl}}/store/order' + host: + - '{{baseUrl}}' + path: + - store + - order + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Returns pet inventories by status + request: + auth: + type: apikey + apikey: + - key: key + value: api_key + type: string + - key: value + value: '' + type: string + - key: in + value: header + type: string + method: GET + header: + - key: Accept + value: application/json + url: + raw: '{{baseUrl}}/store/inventory' + host: + - '{{baseUrl}}' + path: + - store + - inventory + description: Returns a map of status codes to quantities + response: + - name: successful operation + originalRequest: + method: GET + header: + - description: 'Added as a part of security scheme: apikey' + key: api_key + value: '' + url: + raw: '{{baseUrl}}/store/inventory' + host: + - '{{baseUrl}}' + path: + - store + - inventory + status: OK + code: 200 + _postman_previewlanguage: json + header: + - key: Content-Type + value: application/json + cookie: [] + body: |- + { + "dolor_4": -59651882, + "dolor__10": 76938793 + } + - name: user + item: + - name: '{username}' + item: + - name: Get user by user name + request: + method: GET + header: + - key: Accept + value: application/xml + url: + raw: '{{baseUrl}}/user/:username' + host: + - '{{baseUrl}}' + path: + - user + - ':username' + variable: + - key: username + value: dolore est + description: '(Required) The name that needs to be fetched. Use user1 + for testing. ' + response: + - name: successful operation + originalRequest: + method: GET + header: [] + url: + raw: '{{baseUrl}}/user/:username' + host: + - '{{baseUrl}}' + path: + - user + - ':username' + variable: + - key: username + value: dolore est + description: '(Required) The name that needs to be fetched. Use user1 + for testing. ' + status: OK + code: 200 + _postman_previewlanguage: json + header: + - key: Content-Type + value: application/json + cookie: [] + body: |- + { + "id": -70409270, + "username": "do ea nisi", + "firstName": "occaecat dolor in dolore", + "lastName": "laborum sit ullamco", + "email": "nostrud Ut", + "password": "officia occaecat enim l", + "phone": "in elit officia sint", + "userStatus": 86291576 + } + - name: Invalid username supplied + originalRequest: + method: GET + header: [] + url: + raw: '{{baseUrl}}/user/:username' + host: + - '{{baseUrl}}' + path: + - user + - ':username' + variable: + - key: username + value: dolore est + description: '(Required) The name that needs to be fetched. Use user1 + for testing. ' + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: User not found + originalRequest: + method: GET + header: [] + url: + raw: '{{baseUrl}}/user/:username' + host: + - '{{baseUrl}}' + path: + - user + - ':username' + variable: + - key: username + value: dolore est + description: '(Required) The name that needs to be fetched. Use user1 + for testing. ' + status: Not Found + code: 404 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Updated user + request: + method: PUT + header: + - key: Content-Type + value: application/json + body: + mode: raw + raw: |- + { + "id": -70409270, + "username": "do ea nisi", + "firstName": "occaecat dolor in dolore", + "lastName": "laborum sit ullamco", + "email": "nostrud Ut", + "password": "officia occaecat enim l", + "phone": "in elit officia sint", + "userStatus": 86291576 + } + options: + raw: + language: json + url: + raw: '{{baseUrl}}/user/:username' + host: + - '{{baseUrl}}' + path: + - user + - ':username' + variable: + - key: username + value: dolore est + description: '(Required) name that need to be updated' + description: This can only be done by the logged in user. + response: + - name: Invalid user supplied + originalRequest: + method: PUT + header: [] + body: + mode: raw + raw: |- + { + "id": -70409270, + "username": "do ea nisi", + "firstName": "occaecat dolor in dolore", + "lastName": "laborum sit ullamco", + "email": "nostrud Ut", + "password": "officia occaecat enim l", + "phone": "in elit officia sint", + "userStatus": 86291576 + } + options: + raw: + language: json + url: + raw: '{{baseUrl}}/user/:username' + host: + - '{{baseUrl}}' + path: + - user + - ':username' + variable: + - key: username + value: dolore est + description: '(Required) name that need to be updated' + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: User not found + originalRequest: + method: PUT + header: [] + body: + mode: raw + raw: |- + { + "id": -70409270, + "username": "do ea nisi", + "firstName": "occaecat dolor in dolore", + "lastName": "laborum sit ullamco", + "email": "nostrud Ut", + "password": "officia occaecat enim l", + "phone": "in elit officia sint", + "userStatus": 86291576 + } + options: + raw: + language: json + url: + raw: '{{baseUrl}}/user/:username' + host: + - '{{baseUrl}}' + path: + - user + - ':username' + variable: + - key: username + value: dolore est + description: '(Required) name that need to be updated' + status: Not Found + code: 404 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Delete user + request: + method: DELETE + header: [] + url: + raw: '{{baseUrl}}/user/:username' + host: + - '{{baseUrl}}' + path: + - user + - ':username' + variable: + - key: username + value: dolore est + description: '(Required) The name that needs to be deleted' + description: This can only be done by the logged in user. + response: + - name: Invalid username supplied + originalRequest: + method: DELETE + header: [] + url: + raw: '{{baseUrl}}/user/:username' + host: + - '{{baseUrl}}' + path: + - user + - ':username' + variable: + - key: username + value: dolore est + description: '(Required) The name that needs to be deleted' + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: User not found + originalRequest: + method: DELETE + header: [] + url: + raw: '{{baseUrl}}/user/:username' + host: + - '{{baseUrl}}' + path: + - user + - ':username' + variable: + - key: username + value: dolore est + description: '(Required) The name that needs to be deleted' + status: Not Found + code: 404 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Create user + request: + method: POST + header: + - key: Content-Type + value: application/json + body: + mode: raw + raw: |- + { + "id": -70409270, + "username": "do ea nisi", + "firstName": "occaecat dolor in dolore", + "lastName": "laborum sit ullamco", + "email": "nostrud Ut", + "password": "officia occaecat enim l", + "phone": "in elit officia sint", + "userStatus": 86291576 + } + options: + raw: + language: json + url: + raw: '{{baseUrl}}/user' + host: + - '{{baseUrl}}' + path: + - user + description: This can only be done by the logged in user. + response: + - name: successful operation + originalRequest: + method: POST + header: [] + body: + mode: raw + raw: |- + { + "id": -70409270, + "username": "do ea nisi", + "firstName": "occaecat dolor in dolore", + "lastName": "laborum sit ullamco", + "email": "nostrud Ut", + "password": "officia occaecat enim l", + "phone": "in elit officia sint", + "userStatus": 86291576 + } + options: + raw: + language: json + url: + raw: '{{baseUrl}}/user' + host: + - '{{baseUrl}}' + path: + - user + status: Internal Server Error + code: 500 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Creates list of users with given input array + request: + method: POST + header: + - key: Content-Type + value: application/json + body: + mode: raw + raw: |- + [ + { + "id": -95496632, + "username": "reprehenderit Duis", + "firstName": "ipsum enim", + "lastName": "sit incididunt quis su", + "email": "esse in nostrud", + "password": "dolore", + "phone": "ea tempor sed eiusmod", + "userStatus": 23456761 + }, + { + "id": -17610454, + "username": "occaecat in laboris voluptate", + "firstName": "consectetur fugiat", + "lastName": "est consectet", + "email": "ea qui", + "password": "dolor aliquip", + "phone": "nulla eu veniam", + "userStatus": -56036685 + } + ] + options: + raw: + language: json + url: + raw: '{{baseUrl}}/user/createWithArray' + host: + - '{{baseUrl}}' + path: + - user + - createWithArray + response: + - name: successful operation + originalRequest: + method: POST + header: [] + url: + raw: '{{baseUrl}}/user/createWithArray' + host: + - '{{baseUrl}}' + path: + - user + - createWithArray + status: Internal Server Error + code: 500 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Creates list of users with given input array + request: + method: POST + header: + - key: Content-Type + value: application/json + body: + mode: raw + raw: |- + [ + { + "id": -17453134, + "username": "est veniam proident", + "firstName": "adipisic", + "lastName": "ea nisi ut anim", + "email": "culpa voluptate laborum ut", + "password": "veniam id enim voluptate", + "phone": "enim sed", + "userStatus": 31329378 + }, + { + "id": -97425969, + "username": "velit sint ea ad reprehend", + "firstName": "reprehenderit do aliquip", + "lastName": "anim mollit", + "email": "minim qui laborum in", + "password": "exercitation quis", + "phone": "irure", + "userStatus": -62781043 + } + ] + options: + raw: + language: json + url: + raw: '{{baseUrl}}/user/createWithList' + host: + - '{{baseUrl}}' + path: + - user + - createWithList + response: + - name: successful operation + originalRequest: + method: POST + header: [] + url: + raw: '{{baseUrl}}/user/createWithList' + host: + - '{{baseUrl}}' + path: + - user + - createWithList + status: Internal Server Error + code: 500 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Logs user into the system + request: + method: GET + header: + - key: Accept + value: application/xml + url: + raw: '{{baseUrl}}/user/login?username=dolore est&password=dolore est' + host: + - '{{baseUrl}}' + path: + - user + - login + query: + - key: username + value: dolore est + description: '(Required) The user name for login' + - key: password + value: dolore est + description: '(Required) The password for login in clear text' + response: + - name: successful operation + originalRequest: + method: GET + header: [] + url: + raw: '{{baseUrl}}/user/login?username=dolore est&password=dolore est' + host: + - '{{baseUrl}}' + path: + - user + - login + query: + - key: username + value: dolore est + - key: password + value: dolore est + status: OK + code: 200 + _postman_previewlanguage: json + header: + - key: X-Rate-Limit + value: '-71676539' + description: calls per hour allowed by the user + - key: X-Expires-After + value: '1966-01-28T06:32:02.771Z' + description: date in UTC when token expires + - key: Content-Type + value: application/json + cookie: [] + body: '"dolore est"' + - name: Invalid username/password supplied + originalRequest: + method: GET + header: [] + url: + raw: '{{baseUrl}}/user/login?username=dolore est&password=dolore est' + host: + - '{{baseUrl}}' + path: + - user + - login + query: + - key: username + value: dolore est + - key: password + value: dolore est + status: Bad Request + code: 400 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' + - name: Logs out current logged in user session + request: + method: GET + header: [] + url: + raw: '{{baseUrl}}/user/logout' + host: + - '{{baseUrl}}' + path: + - user + - logout + response: + - name: successful operation + originalRequest: + method: GET + header: [] + url: + raw: '{{baseUrl}}/user/logout' + host: + - '{{baseUrl}}' + path: + - user + - logout + status: Internal Server Error + code: 500 + _postman_previewlanguage: text + header: + - key: Content-Type + value: text/plain + cookie: [] + body: '' +variable: + - key: baseUrl + value: http://petstore.swagger.io/v2 + type: string diff --git a/__tests__/cmds/openapi/index.test.ts b/__tests__/cmds/openapi/index.test.ts index 7d6cc1e8b..b5777cf7b 100644 --- a/__tests__/cmds/openapi/index.test.ts +++ b/__tests__/cmds/openapi/index.test.ts @@ -75,6 +75,10 @@ describe('rdme openapi', () => { ['OpenAPI 3.0', 'yaml', '3.0', 'OpenAPI'], ['OpenAPI 3.1', 'json', '3.1', 'OpenAPI'], ['OpenAPI 3.1', 'yaml', '3.1', 'OpenAPI'], + + // Postman collections get automatically converted to OpenAPI 3.0 by `oas-normalize`. + ['Postman', 'json', '3.0', 'Postman'], + ['Postman', 'yaml', '3.0', 'Postman'], ])('should support uploading a %s definition (format: %s)', async (_, format, specVersion, type) => { const registryUUID = getRandomRegistryId(); @@ -93,7 +97,12 @@ describe('rdme openapi', () => { .basicAuth({ user: key }) .reply(201, { _id: 1 }, { location: exampleRefLocation }); - const spec = require.resolve(`@readme/oas-examples/${specVersion}/${format}/petstore.${format}`); + let spec; + if (type === 'Postman') { + spec = require.resolve(`../../__fixtures__/postman/petstore.collection.${format}`); + } else { + spec = require.resolve(`@readme/oas-examples/${specVersion}/${format}/petstore.${format}`); + } await expect( openapi.run({ diff --git a/package-lock.json b/package-lock.json index 2ec3af427..9243374d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "mime-types": "^2.1.35", "node-fetch": "^2.6.1", "oas": "^20.0.0", - "oas-normalize": "^7.1.0", + "oas-normalize": "^8.1.1", "open": "^8.2.1", "ora": "^5.4.1", "parse-link-header": "^2.0.0", @@ -2958,6 +2958,14 @@ "node": ">=4" } }, + "node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, "node_modules/comment-parser": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.1.tgz", @@ -6640,6 +6648,11 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==" + }, "node_modules/jsonpath": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/jsonpath/-/jsonpath-1.1.1.tgz", @@ -6879,6 +6892,17 @@ "tmpl": "1.0.5" } }, + "node_modules/marked": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.2.2.tgz", + "integrity": "sha512-JjBTFTAvuTgANXx82a5vzK9JLSMoV6V3LBVn4Uhdso6t7vXrGx7g1Cd2r6NYSsxrYbQGFCMqBDhFHyK5q2UvcQ==", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/memoizee": { "version": "0.4.15", "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz", @@ -6979,6 +7003,14 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/mustache": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", + "bin": { + "mustache": "bin/mustache" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -7157,14 +7189,15 @@ } }, "node_modules/oas-normalize": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-7.1.0.tgz", - "integrity": "sha512-a3rWTwmePXGFq8lutfCR3cFC5DerKXZW+Rd1U9t1TJUsedVng40DxG8P+rYBaoe/MWQKfy5reid8gWD7QSzaHg==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-8.1.1.tgz", + "integrity": "sha512-H+jCpVrVBpr2M23ZkvnMNXHSOvCdNZO0NotW38WJC7aufxnrbiPbzlN5S0gvhSp3GUym2O4hczkwcuPFV6gc/Q==", "dependencies": { "@readme/openapi-parser": "^2.3.0", "js-yaml": "^4.1.0", "node-fetch": "^2.6.1", "openapi-types": "^12.0.0", + "postman-to-openapi": "^2.7.1", "swagger2openapi": "^7.0.8" }, "engines": { @@ -7215,6 +7248,21 @@ "url": "https://github.com/Mermade/oas-kit?sponsor=1" } }, + "node_modules/oas/node_modules/oas-normalize": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-7.1.1.tgz", + "integrity": "sha512-5ZSkbkhiDN5K0eTIkGkDAef6ta6l713/6XIc1wfnZZzjG13RSR9M6ON13nY5opwNjhKnXhssIK48cIUVs6z3gA==", + "dependencies": { + "@readme/openapi-parser": "^2.3.0", + "js-yaml": "^4.1.0", + "node-fetch": "^2.6.1", + "openapi-types": "^12.0.0", + "swagger2openapi": "^7.0.8" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -7628,6 +7676,25 @@ "node": ">=4" } }, + "node_modules/postman-to-openapi": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/postman-to-openapi/-/postman-to-openapi-2.9.0.tgz", + "integrity": "sha512-Q/b2TMDBZBL98hkN/zpSOXUNvwfT3ovbzLaMWx3O9CWE1CjArSzUWqfmsxrDAAeQ655UebPw4/WBoaKVtYy75w==", + "dependencies": { + "commander": "^8.3.0", + "js-yaml": "^4.1.0", + "jsonc-parser": "3.2.0", + "lodash.camelcase": "^4.3.0", + "marked": "^4.2.2", + "mustache": "^4.2.0" + }, + "bin": { + "p2o": "bin/cli.js" + }, + "engines": { + "node": ">=12 <18" + } + }, "node_modules/prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -11529,6 +11596,11 @@ } } }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==" + }, "comment-parser": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.3.1.tgz", @@ -14246,6 +14318,11 @@ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==" }, + "jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==" + }, "jsonpath": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/jsonpath/-/jsonpath-1.1.1.tgz", @@ -14439,6 +14516,11 @@ "tmpl": "1.0.5" } }, + "marked": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.2.2.tgz", + "integrity": "sha512-JjBTFTAvuTgANXx82a5vzK9JLSMoV6V3LBVn4Uhdso6t7vXrGx7g1Cd2r6NYSsxrYbQGFCMqBDhFHyK5q2UvcQ==" + }, "memoizee": { "version": "0.4.15", "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz", @@ -14518,6 +14600,11 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "mustache": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==" + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -14647,6 +14734,20 @@ "oas-normalize": "^7.1.0", "openapi-types": "^12.0.0", "path-to-regexp": "^6.2.0" + }, + "dependencies": { + "oas-normalize": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-7.1.1.tgz", + "integrity": "sha512-5ZSkbkhiDN5K0eTIkGkDAef6ta6l713/6XIc1wfnZZzjG13RSR9M6ON13nY5opwNjhKnXhssIK48cIUVs6z3gA==", + "requires": { + "@readme/openapi-parser": "^2.3.0", + "js-yaml": "^4.1.0", + "node-fetch": "^2.6.1", + "openapi-types": "^12.0.0", + "swagger2openapi": "^7.0.8" + } + } } }, "oas-kit-common": { @@ -14668,14 +14769,15 @@ } }, "oas-normalize": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-7.1.0.tgz", - "integrity": "sha512-a3rWTwmePXGFq8lutfCR3cFC5DerKXZW+Rd1U9t1TJUsedVng40DxG8P+rYBaoe/MWQKfy5reid8gWD7QSzaHg==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/oas-normalize/-/oas-normalize-8.1.1.tgz", + "integrity": "sha512-H+jCpVrVBpr2M23ZkvnMNXHSOvCdNZO0NotW38WJC7aufxnrbiPbzlN5S0gvhSp3GUym2O4hczkwcuPFV6gc/Q==", "requires": { "@readme/openapi-parser": "^2.3.0", "js-yaml": "^4.1.0", "node-fetch": "^2.6.1", "openapi-types": "^12.0.0", + "postman-to-openapi": "^2.7.1", "swagger2openapi": "^7.0.8" } }, @@ -15009,6 +15111,19 @@ "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", "dev": true }, + "postman-to-openapi": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/postman-to-openapi/-/postman-to-openapi-2.9.0.tgz", + "integrity": "sha512-Q/b2TMDBZBL98hkN/zpSOXUNvwfT3ovbzLaMWx3O9CWE1CjArSzUWqfmsxrDAAeQ655UebPw4/WBoaKVtYy75w==", + "requires": { + "commander": "^8.3.0", + "js-yaml": "^4.1.0", + "jsonc-parser": "3.2.0", + "lodash.camelcase": "^4.3.0", + "marked": "^4.2.2", + "mustache": "^4.2.0" + } + }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", diff --git a/package.json b/package.json index c3eaeed75..15eedb8cf 100644 --- a/package.json +++ b/package.json @@ -12,19 +12,20 @@ }, "keywords": [ "api", + "apidoc", "apis", + "documentation", + "microservice", + "oai", + "oas", "openapi", - "swagger", + "openapi document", "openapi initiative", - "openapi specification", "openapi spec", - "openapi document", - "oai", - "oas", - "apidoc", - "microservice", - "documentation", - "readme" + "openapi specification", + "postman", + "readme", + "swagger" ], "repository": { "type": "git", @@ -50,7 +51,7 @@ "mime-types": "^2.1.35", "node-fetch": "^2.6.1", "oas": "^20.0.0", - "oas-normalize": "^7.1.0", + "oas-normalize": "^8.1.1", "open": "^8.2.1", "ora": "^5.4.1", "parse-link-header": "^2.0.0", diff --git a/src/lib/prepareOas.ts b/src/lib/prepareOas.ts index cdcf0d76d..96f592d60 100644 --- a/src/lib/prepareOas.ts +++ b/src/lib/prepareOas.ts @@ -1,5 +1,5 @@ import chalk from 'chalk'; -import OASNormalize from 'oas-normalize'; +import OASNormalize, { getAPIDefinitionType } from 'oas-normalize'; import ora from 'ora'; import isCI from './isCI'; @@ -65,12 +65,13 @@ export default async function prepareOas(path: string, command: 'openapi' | 'ope const oas = new OASNormalize(file, { enablePaths: true }); return oas .version() - .then(version => { - debug(`OpenAPI/Swagger version for ${file}: ${version}`); - return version ? file : ''; + .then(({ specification, version }) => { + debug(`specification type for ${file}: ${specification}`); + debug(`version for ${file}: ${version}`); + return ['openapi', 'swagger', 'postman'].includes(specification) ? file : ''; }) .catch(e => { - debug(`error extracting OpenAPI/Swagger version for ${file}: ${e.message}`); + debug(`error extracting API definition specification version for ${file}: ${e.message}`); return ''; }); }) @@ -116,7 +117,20 @@ export default async function prepareOas(path: string, command: 'openapi' | 'ope const oas = new OASNormalize(specPath, { colorizeErrors: true, enablePaths: true }); debug('spec normalized'); - const api = await oas.validate(false).catch((err: Error) => { + // We're retrieving the original specification type here instead of after validation because if + // they give us a Postman colletion we should tell them that we handled a Postman collection, not + // an OpenAPI definition (eventhough we'll actually convert it to OpenAPI under the hood). + // + // And though `.validate()` will run `.load()` itself running `.load()` here will not have any + // performance implications as `oas-normalizes` caches the result of `.load()` the first time you + // run it. + const specType = await oas.load().then(schema => { + const type = getAPIDefinitionType(schema); + return type === 'openapi' ? 'OpenAPI' : type.charAt(0).toUpperCase() + type.slice(1); + }); + + // If we were supplied a Postman collection this will **always** convert it to OpenAPI 3.0. + const api = await oas.validate({ convertToLatest: false }).catch((err: Error) => { spinner.fail(); debug(`raw validation error object: ${JSON.stringify(err)}`); throw err; @@ -126,8 +140,6 @@ export default async function prepareOas(path: string, command: 'openapi' | 'ope debug('👇👇👇👇👇 spec validated! logging spec below 👇👇👇👇👇'); debug(api); debug('👆👆👆👆👆 finished logging spec 👆👆👆👆👆'); - - const specType = api.swagger ? 'Swagger' : 'OpenAPI'; debug(`spec type: ${specType}`); // No need to optional chain here since `info.version` is required to pass validation