openapi-sampler
Advanced tools
Comparing version
@@ -233,3 +233,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.OpenAPISampler = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
@@ -241,3 +241,3 @@ exports.sampleObject = sampleObject; | ||
function sampleObject(schema) { | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -378,3 +378,3 @@ var res = {}; | ||
if (sampler) return sampler(schema, options); | ||
return {}; | ||
return null; | ||
} | ||
@@ -381,0 +381,0 @@ |
{ | ||
"name": "openapi-sampler", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "Tool for generation samples based on OpenAPI payload/response schema", | ||
@@ -16,4 +16,3 @@ "main": "dist/openapi-sampler.js", | ||
"prepublish": "npm run build", | ||
"branch-release": "travis-after-all && branch-release", | ||
"after-all-publish": "travis-after-all && npm publish" | ||
"branch-release": "branch-release" | ||
}, | ||
@@ -39,3 +38,3 @@ "repository": { | ||
"babel-core": "^6.3.26", | ||
"babel-eslint": "^6.0.4", | ||
"babel-eslint": "^7.1.1", | ||
"babel-loader": "^6.2.0", | ||
@@ -47,3 +46,3 @@ "babel-polyfill": "^6.3.14", | ||
"branch-release": "^1.0.3", | ||
"browserify": "^13.0.1", | ||
"browserify": "^14.1.0", | ||
"browserify-istanbul": "^2.0.0", | ||
@@ -55,23 +54,23 @@ "chai": "^3.5.0", | ||
"gulp": "^3.9.0", | ||
"gulp-eslint": "^2.0.0", | ||
"gulp-filter": "^4.0.0", | ||
"gulp-istanbul": "^0.10.3", | ||
"gulp-jscs": "^3.0.2", | ||
"gulp-eslint": "^3.0.1", | ||
"gulp-filter": "^5.0.0", | ||
"gulp-istanbul": "^1.1.1", | ||
"gulp-jscs": "^4.0.0", | ||
"gulp-livereload": "^3.8.1", | ||
"gulp-load-plugins": "^1.1.0", | ||
"gulp-mocha": "^2.2.0", | ||
"gulp-mocha": "^4.0.1", | ||
"gulp-plumber": "^1.0.1", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-uglify": "^1.5.1", | ||
"gulp-sourcemaps": "^2.4.1", | ||
"gulp-uglify": "^2.0.1", | ||
"gulp-util": "^3.0.7", | ||
"isparta": "^4.0.0", | ||
"json-loader": "^0.5.3", | ||
"karma": "^0.13.22", | ||
"karma": "^1.5.0", | ||
"karma-babel-preprocessor": "^6.0.1", | ||
"karma-browserify": "^5.0.3", | ||
"karma-chrome-launcher": "^0.2.3", | ||
"karma-coverage": "^0.5.5", | ||
"karma-firefox-launcher": "^0.1.7", | ||
"karma-mocha": "^0.2.2", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-coverage": "^1.1.1", | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.0.0", | ||
@@ -81,3 +80,3 @@ "karma-phantomjs-launcher": "^1.0.0", | ||
"lolex": "^1.5.0", | ||
"mocha": "^2.3.4", | ||
"mocha": "^3.2.0", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
@@ -87,3 +86,2 @@ "require-dir": "^0.3.0", | ||
"sinon-chai": "^2.8.0", | ||
"travis-after-all": "^1.4.4", | ||
"vinyl-buffer": "^1.0.0", | ||
@@ -90,0 +88,0 @@ "vinyl-source-stream": "^1.1.0", |
@@ -24,3 +24,3 @@ import { _samplers } from './openapi-sampler'; | ||
if (sampler) return sampler(schema, options); | ||
return {}; | ||
return null; | ||
} |
@@ -46,2 +46,10 @@ 'use strict'; | ||
}); | ||
it('should use null if type is not specified', function() { | ||
schema = { | ||
}; | ||
result = OpenAPISampler.sample(schema); | ||
expected = null; | ||
expect(result).to.deep.equal(expected); | ||
}); | ||
}); | ||
@@ -48,0 +56,0 @@ |
@@ -23,4 +23,4 @@ import { sampleArray } from '../../src/samplers/array'; | ||
res = sampleArray({items: [{type: 'number'}, {type: 'string'}, {}]}); | ||
expect(res).to.deep.equal([0, 'string', {}]); | ||
expect(res).to.deep.equal([0, 'string', null]); | ||
}); | ||
}); |
@@ -42,3 +42,3 @@ import { sampleString } from '../../src/samplers/string'; | ||
res = sampleString({format: 'password', minLength: 20}); | ||
expect(res.substring(0,9)).to.equal('pa$$word_'); | ||
expect(res.substring(0, 9)).to.equal('pa$$word_'); | ||
expect(res.length).to.equal(20); | ||
@@ -45,0 +45,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
241950
389.8%48
-2.04%42
2.44%1232
0.57%