Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.0 to 1.0.1

4

CHANGELOG.md
# OpenAPI-Postman Changelog
#### v1.0.1 (Jan 01, 2020)
* Deleting 'info.version' from generated collection JSON - it's not required and was causing versioning problems
* Scope-related bugfixes in schema validation flows
#### v1.0.0 (Dec 31, 2019)

@@ -4,0 +8,0 @@ * New API to validate requests against a schema

15

lib/schemapack.js

@@ -128,3 +128,4 @@ 'use strict';

generatedStore = {},
folderObj;
folderObj,
collectionJSON;

@@ -151,4 +152,3 @@ if (!this.validated) {

info: {
name: _.get(openapi, 'info.title', COLLECTION_NAME),
version: _.get(openapi, 'info.version')
name: _.get(openapi, 'info.title', COLLECTION_NAME)
}

@@ -212,2 +212,9 @@ });

collectionJSON = generatedStore.collection.toJSON();
// this needs to be deleted as even if version is not specified to sdk,
// it returns a version property with value set as undefined
// this fails validation against v2.1 collection schema definition.
delete collectionJSON.info.version;
return callback(null, {

@@ -217,3 +224,3 @@ result: true,

type: 'collection',
data: generatedStore.collection.toJSON()
data: collectionJSON
}]

@@ -220,0 +227,0 @@ });

{
"name": "openapi-to-postmanv2",
"version": "1.0.0",
"version": "1.0.1",
"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":"a57951df-7878-41a2-8ca6-c3b6c914ed34","name":"pets","item":[{"id":"be4cfbed-8286-4281-8ed4-65e392930444","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":"74788765-1877-4c3b-af41-7d888df3fd10","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":"fb21f648-e65d-4b13-8056-97c09d2e6336","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":"686c4e19-b6e2-482e-a278-937e84b7892a","name":"Create a pet","request":{"name":"Create a pet","description":{},"url":{"path":["pets"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"method":"POST","auth":{"type":"noauth"}},"response":[{"id":"022429bb-e6d9-4b7c-add0-bdb41348426c","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":"e63f67aa-e75c-4567-8edd-9dc138bfb080","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":"8c8eee28-ee88-462e-80b5-a93c292ac50c","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":"e35d324b-9caa-45ae-8b05-471bcf57bd9c","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":"36b4049a-2bc8-4c9c-a1a5-28bc27183ea5","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":"cde792e0-4276-4a47-b7ae-2ef21828cd03","name":"Swagger Petstore","version":{"raw":"1.0.0","major":1,"minor":0,"patch":0,"prerelease":[],"build":[],"string":"1.0.0"},"schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json","description":{"content":"","type":"text/plain"}}}
{"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"}}}

@@ -182,2 +182,10 @@ var expect = require('chai').expect,

});
it('Should remove the version from generated collection for all specs', function(done) {
Converter.convert({ type: 'file', data: testSpec }, { schemaFaker: true }, (err, conversionResult) => {
expect(err).to.be.null;
expect(conversionResult.result).to.equal(true);
expect(conversionResult.output[0].data.info).to.not.have.property('version');
done();
});
});
describe('[Github #108]- Parameters resolution option', function() {

@@ -184,0 +192,0 @@ it('Should respect schema faking for root request and example for example request' +

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