Socket
Socket
Sign inDemoInstall

@stoplight/json-schema-sampler

Package Overview
Dependencies
3
Maintainers
24
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

9

dist/json-schema-sampler.js

@@ -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

2

package.json
{
"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;
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc