openapi-sampler
Advanced tools
Comparing version 1.2.3 to 1.3.0
@@ -466,3 +466,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(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
var items = schema.items || schema.contains; | ||
var items = schema.prefixItems || schema.items || schema.contains; | ||
@@ -474,3 +474,3 @@ if (Array.isArray(items)) { | ||
var itemSchemaGetter = function itemSchemaGetter(itemNumber) { | ||
if (Array.isArray(schema.items)) { | ||
if (Array.isArray(items)) { | ||
return items[itemNumber] || {}; | ||
@@ -875,2 +875,6 @@ } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
@@ -1006,3 +1010,8 @@ | ||
(0, _utils.popSchemaStack)(seenSchemasStack, context); | ||
return tryInferExample(schema) || traverse((0, _utils.mergeDeep)(schema.if, schema.then), options, spec, context); | ||
var ifSchema = schema.if, | ||
then = schema.then, | ||
rest = _objectWithoutProperties(schema, ["if", "then"]); | ||
return traverse((0, _utils.mergeDeep)(rest, ifSchema, then), options, spec, context); | ||
} | ||
@@ -1009,0 +1018,0 @@ |
{ | ||
"name": "openapi-sampler", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"description": "Tool for generation samples based on OpenAPI payload/response schema", | ||
@@ -5,0 +5,0 @@ "main": "dist/openapi-sampler.js", |
@@ -7,3 +7,3 @@ import { traverse } from '../traverse'; | ||
// for the sake of simplicity, we're treating `contains` in a similar way to `items` | ||
const items = schema.items || schema.contains; | ||
const items = schema.prefixItems || schema.items || schema.contains; | ||
if (Array.isArray(items)) { | ||
@@ -14,3 +14,3 @@ arrayLength = Math.max(arrayLength, items.length); | ||
let itemSchemaGetter = itemNumber => { | ||
if (Array.isArray(schema.items)) { | ||
if (Array.isArray(items)) { | ||
return items[itemNumber] || {}; | ||
@@ -17,0 +17,0 @@ } |
@@ -132,3 +132,4 @@ import { _samplers } from './openapi-sampler'; | ||
popSchemaStack(seenSchemasStack, context); | ||
return tryInferExample(schema) || traverse(mergeDeep(schema.if, schema.then), options, spec, context); | ||
const { if: ifSchema, then, ...rest } = schema; | ||
return traverse(mergeDeep(rest, ifSchema, then), options, spec, context); | ||
} | ||
@@ -135,0 +136,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62061
1516