Socket
Socket
Sign inDemoInstall

openapi-to-postmanv2

Package Overview
Dependencies
Maintainers
1
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-to-postmanv2 - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

CHANGELOG.md
# OpenAPI-Postman Changelog
#### v1.0.2 (Jan 01, 2020)
* Exposing option to hide MISSING_IN_SCHEMA mismatches, hiding them by default
* Consistent response formats, more resilient against invalid schemas
#### v1.0.1 (Jan 01, 2020)

@@ -4,0 +8,0 @@ * Deleting 'info.version' from generated collection JSON - it's not required and was causing versioning problems

@@ -109,2 +109,11 @@ const _ = require('lodash');

external: true
},
{
name: 'Whether MISSING_IN_SCHEMA mismatches should be returned',
id: 'showMissingInSchemaErrors',
type: 'boolean',
default: false,
description: 'MISSING_IN_SCHEMA indicates that an extra parameter was included in the request. For most ' +
'use cases, this need not be considered an error.',
external: true
}

@@ -111,0 +120,0 @@ ];

23

lib/schemapack.js

@@ -248,2 +248,6 @@ 'use strict';

async.map(transactions, (transaction, requestCallback) => {
if (!transaction.id || !transaction.request) {
return requestCallback(new Error('All transactions must have `id` and `request` properties.'));
}
let requestUrl = transaction.request.url,

@@ -339,4 +343,8 @@ matchedPaths;

}, (err, result) => {
var singleMismatch = false,
retVal;
var retVal;
if (err) {
return callback(err);
}
// determine if any endpoint for any request misatched

@@ -347,3 +355,2 @@ _.each(result, (reqRes) => {

if (!ep.matched) {
thisMismatch = true;
return false;

@@ -353,10 +360,10 @@ }

if (thisMismatch) {
singleMismatch = true;
return false;
}
});
retVal = {};
if (singleMismatch && result) {
retVal.requests = _.keyBy(result, 'requestId');
}
retVal = {
requests: _.keyBy(result, 'requestId')
};
callback(null, retVal);

@@ -363,0 +370,0 @@ });

{
"name": "openapi-to-postmanv2",
"version": "1.0.1",
"version": "1.0.2",
"description": "Convert a given OpenAPI specification to Postman Collection v2.0",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/postmanlabs/openapi-to-postman",

@@ -1,1 +0,1 @@

{"item":[{"id":"8bb8f372-15b0-4af7-afe4-5e62b92709fb","name":"pets","item":[{"id":"408e0e99-bec4-4790-93e8-9a4d065927bb","name":"List all pets","request":{"name":"List all pets","description":{},"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[{"description":"random variable","key":"variable","value":"<string>,<string>"},{"description":"another random variable","key":"variable2","value":"<long> <long>"}],"variable":[]},"header":[{"key":"limit","value":"<integer>","description":"How many items to return at one time (max 100)"}],"method":"GET","auth":{"type":"noauth"}},"response":[{"id":"3df70a94-dad8-45d4-9c53-dde23f29c4a6","name":"An paged array of pets","originalRequest":{"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[{"key":"variable","value":"<string>,<string>"},{"key":"variable2","value":"<long> <long>"}],"variable":[]},"method":"GET","body":{}},"status":"OK","code":200,"header":[{"key":"x-next","value":"<string>","description":"A link to the next page of responses"},{"key":"Content-Type","value":"application/json"}],"body":"[\n {\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"tag\": \"<string>\"\n },\n {\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"tag\": \"<string>\"\n }\n]","cookie":[],"_postman_previewlanguage":"json"},{"id":"9bf2dd77-a835-409c-8fef-0c9f61b95ae1","name":"unexpected error","originalRequest":{"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[{"key":"variable","value":"<string>,<string>"},{"key":"variable2","value":"<long> <long>"}],"variable":[]},"header":[{"key":"limit","value":"<integer>","description":"How many items to return at one time (max 100)"},{"key":"limit","value":"<integer>","description":"How many items to return at one time (max 100)"}],"method":"GET","body":{}},"status":"Internal Server Error","code":500,"header":[{"key":"Content-Type","value":"application/json"}],"body":"{\n \"code\": \"<integer>\",\n \"message\": \"<string>\"\n}","cookie":[],"_postman_previewlanguage":"json"}],"event":[]},{"id":"81b5002d-4533-4597-a6cd-a4dfc137acc1","name":"Create a pet","request":{"name":"Create a pet","description":{},"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"POST","auth":{"type":"noauth"}},"response":[{"id":"53282f5a-741c-42cf-8c34-b789ca9d1942","name":"Null response","originalRequest":{"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"POST","body":{}},"status":"Created","code":201,"header":[{"key":"Content-Type","value":"text/plain"}],"body":"","cookie":[],"_postman_previewlanguage":"text"},{"id":"90a09d3a-471b-439d-a2fb-8b516ffb0b90","name":"unexpected error","originalRequest":{"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"POST","body":{}},"status":"Internal Server Error","code":500,"header":[{"key":"Content-Type","value":"application/json"}],"body":"{\n \"code\": \"<integer>\",\n \"message\": \"<string>\"\n}","cookie":[],"_postman_previewlanguage":"json"}],"event":[]},{"id":"8500da81-9d98-4c6b-87db-2b50f71b94e6","name":"Info for a specific pet","request":{"name":"Info for a specific pet","description":{},"url":{"path":["pets",":petId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"description":{"content":"The id of the pet to retrieve","type":"text/plain"},"type":"any","value":"<string>","key":"petId"}]},"method":"GET","auth":{"type":"noauth"}},"response":[{"id":"0c0f8286-c0fe-4864-92d7-cb95045bcb5c","name":"Expected response to a valid request","originalRequest":{"url":{"path":["pets",":petId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"type":"any","key":"petId"}]},"method":"GET","body":{}},"status":"OK","code":200,"header":[{"key":"Content-Type","value":"application/json"}],"body":"{\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"tag\": \"<string>\"\n}","cookie":[],"_postman_previewlanguage":"json"},{"id":"1af9c887-9933-42df-92a2-728bd4ebb506","name":"unexpected error","originalRequest":{"url":{"path":["pets",":petId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"type":"any","key":"petId"}]},"method":"GET","body":{}},"status":"Internal Server Error","code":500,"header":[{"key":"Content-Type","value":"application/json"}],"body":"{\n \"code\": \"<integer>\",\n \"message\": \"<string>\"\n}","cookie":[],"_postman_previewlanguage":"json"}],"event":[]}],"event":[]}],"event":[],"variable":[{"id":"baseUrl","type":"string","value":"http://petstore.swagger.io/v1"}],"info":{"_postman_id":"e4f555f0-7c78-4f8b-83cc-356536e0f393","name":"Swagger Petstore","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json","description":{"content":"","type":"text/plain"}}}
{"item":[{"id":"39d39d24-a0fc-4cc2-932b-083c7a8efbfb","name":"pets","item":[{"id":"7ddf91c6-7095-4553-8cc9-86e1a135c55b","name":"List all pets","request":{"name":"List all pets","description":{},"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[{"description":"random variable","key":"variable","value":"<string>,<string>"},{"description":"another random variable","key":"variable2","value":"<long> <long>"}],"variable":[]},"header":[{"key":"limit","value":"<integer>","description":"How many items to return at one time (max 100)"}],"method":"GET","auth":{"type":"noauth"}},"response":[{"id":"03cc132a-f2f7-48b3-9de7-88df1283781e","name":"An paged array of pets","originalRequest":{"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[{"key":"variable","value":"<string>,<string>"},{"key":"variable2","value":"<long> <long>"}],"variable":[]},"method":"GET","body":{}},"status":"OK","code":200,"header":[{"key":"x-next","value":"<string>","description":"A link to the next page of responses"},{"key":"Content-Type","value":"application/json"}],"body":"[\n {\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"tag\": \"<string>\"\n },\n {\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"tag\": \"<string>\"\n }\n]","cookie":[],"_postman_previewlanguage":"json"},{"id":"71a218cd-aefb-4682-af26-0ae6f925c31f","name":"unexpected error","originalRequest":{"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[{"key":"variable","value":"<string>,<string>"},{"key":"variable2","value":"<long> <long>"}],"variable":[]},"header":[{"key":"limit","value":"<integer>","description":"How many items to return at one time (max 100)"},{"key":"limit","value":"<integer>","description":"How many items to return at one time (max 100)"}],"method":"GET","body":{}},"status":"Internal Server Error","code":500,"header":[{"key":"Content-Type","value":"application/json"}],"body":"{\n \"code\": \"<integer>\",\n \"message\": \"<string>\"\n}","cookie":[],"_postman_previewlanguage":"json"}],"event":[]},{"id":"924f093a-5572-4fa1-8bb8-ddc979ff0471","name":"Create a pet","request":{"name":"Create a pet","description":{},"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"POST","auth":{"type":"noauth"}},"response":[{"id":"61968c9e-d8fe-445d-8b03-b2c9a0a9577a","name":"Null response","originalRequest":{"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"POST","body":{}},"status":"Created","code":201,"header":[{"key":"Content-Type","value":"text/plain"}],"body":"","cookie":[],"_postman_previewlanguage":"text"},{"id":"53c08650-3f61-4cc3-a268-5efb0f5155ec","name":"unexpected error","originalRequest":{"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"POST","body":{}},"status":"Internal Server Error","code":500,"header":[{"key":"Content-Type","value":"application/json"}],"body":"{\n \"code\": \"<integer>\",\n \"message\": \"<string>\"\n}","cookie":[],"_postman_previewlanguage":"json"}],"event":[]},{"id":"53fb08f7-d056-4fae-b5a2-49076ecf3be2","name":"Info for a specific pet","request":{"name":"Info for a specific pet","description":{},"url":{"path":["pets",":petId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"description":{"content":"The id of the pet to retrieve","type":"text/plain"},"type":"any","value":"<string>","key":"petId"}]},"method":"GET","auth":{"type":"noauth"}},"response":[{"id":"d5646ec8-0f04-471c-acaa-964a70932485","name":"Expected response to a valid request","originalRequest":{"url":{"path":["pets",":petId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"type":"any","key":"petId"}]},"method":"GET","body":{}},"status":"OK","code":200,"header":[{"key":"Content-Type","value":"application/json"}],"body":"{\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"tag\": \"<string>\"\n}","cookie":[],"_postman_previewlanguage":"json"},{"id":"98a43f44-6e63-4ad3-9abd-af306294da4f","name":"unexpected error","originalRequest":{"url":{"path":["pets",":petId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"type":"any","key":"petId"}]},"method":"GET","body":{}},"status":"Internal Server Error","code":500,"header":[{"key":"Content-Type","value":"application/json"}],"body":"{\n \"code\": \"<integer>\",\n \"message\": \"<string>\"\n}","cookie":[],"_postman_previewlanguage":"json"}],"event":[]}],"event":[]}],"event":[],"variable":[{"id":"baseUrl","type":"string","value":"http://petstore.swagger.io/v1"}],"info":{"_postman_id":"9443f2d7-9250-41fb-9c58-7457bedf4ecf","name":"Swagger Petstore","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json","description":{"content":"","type":"text/plain"}}}

@@ -11,3 +11,4 @@ let expect = require('chai').expect,

'requestNameSource',
'validationPropertiesToIgnore'
'validationPropertiesToIgnore',
'showMissingInSchemaErrors'
],

@@ -72,2 +73,9 @@ expectedOptions = {

' HEADER, BODY, RESPONSE_HEADER, RESPONSE_BODY'
},
showMissingInSchemaErrors: {
name: 'Whether MISSING_IN_SCHEMA mismatches should be returned',
type: 'boolean',
default: false,
description: 'MISSING_IN_SCHEMA indicates that an extra parameter was included in the request. For most ' +
'use cases, this need not be considered an error.'
}

@@ -74,0 +82,0 @@ };

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc