@stoplight/json-schema-sampler
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -417,3 +417,4 @@ (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.JSONSchemaSampler = 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){ | ||
skipReadOnly: false, | ||
maxSampleDepth: 15 | ||
maxSampleDepth: 15, | ||
ticks: 1000 | ||
}; | ||
@@ -856,2 +857,8 @@ | ||
function traverse(schema, options, doc, context) { | ||
options.ticks -= 1; | ||
if (options.ticks === 0) { | ||
throw Error('Schema size exceeded'); | ||
} | ||
if (seenSchemasStack.includes(schema)) return (0, _utils.getResultForCircular)((0, _infer.inferType)(schema)); | ||
@@ -858,0 +865,0 @@ seenSchemasStack.push(schema); //context is passed only when traversing through nested objects happens |
{ | ||
"name": "@stoplight/json-schema-sampler", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Tool for generation samples based on JSON Schema Draft 7", | ||
@@ -5,0 +5,0 @@ "main": "dist/json-schema-sampler.js", |
@@ -9,2 +9,3 @@ import { traverse, clearCache } from './traverse'; | ||
maxSampleDepth: 15, | ||
ticks: 1000, | ||
}; | ||
@@ -11,0 +12,0 @@ |
@@ -17,2 +17,8 @@ import { _samplers } from './json-schema-sampler'; | ||
export function traverse(schema, options, doc, context) { | ||
options.ticks -= 1; | ||
if (options.ticks === 0) { | ||
throw Error('Schema size exceeded'); | ||
} | ||
if (seenSchemasStack.includes(schema)) | ||
@@ -19,0 +25,0 @@ return getResultForCircular(inferType(schema)); |
@@ -9,4 +9,5 @@ import type { JSONSchema7 } from 'json-schema'; | ||
readonly maxSampleDepth?: number; | ||
readonly ticks?: number; | ||
} | ||
export function sample(schema: JSONSchema7, options?: Options, document?: object): unknown; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
55437
1364