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

8

dist/json-schema-sampler.js

@@ -855,8 +855,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){

function traverse(schema, options, doc, context) {
// checking circular JS references by checking context
// because context is passed only when traversing through nested objects happens
if (context) {
if (seenSchemasStack.includes(schema)) return (0, _utils.getResultForCircular)((0, _infer.inferType)(schema));
seenSchemasStack.push(schema);
}
if (seenSchemasStack.includes(schema)) return (0, _utils.getResultForCircular)((0, _infer.inferType)(schema));
seenSchemasStack.push(schema); //context is passed only when traversing through nested objects happens

@@ -863,0 +859,0 @@ if (context && context.depth > options.maxSampleDepth) {

{
"name": "@stoplight/json-schema-sampler",
"version": "0.2.0",
"version": "0.2.1",
"description": "Tool for generation samples based on JSON Schema Draft 7",

@@ -5,0 +5,0 @@ "main": "dist/json-schema-sampler.js",

@@ -68,2 +68,4 @@ # @stoplight/json-schema-sampler

Don't log console warning messages
- **maxSampleDepth** - `number`
Max depth sampler should traverse
- **doc** - the whole schema where the schema is taken from. Might be useful when the `schema` passed is only a portion of the whole schema and $refs aren't resected. **doc** must not contain any external references

@@ -70,0 +72,0 @@

@@ -17,10 +17,7 @@ import { _samplers } from './json-schema-sampler';

export function traverse(schema, options, doc, context) {
// checking circular JS references by checking context
// because context is passed only when traversing through nested objects happens
if (context) {
if (seenSchemasStack.includes(schema)) return getResultForCircular(inferType(schema));
seenSchemasStack.push(schema);
}
if (seenSchemasStack.includes(schema))
return getResultForCircular(inferType(schema));
seenSchemasStack.push(schema);
//context is passed only when traversing through nested objects happens
if (context && context.depth > options.maxSampleDepth) {

@@ -27,0 +24,0 @@ popSchemaStack(seenSchemasStack, context);

@@ -8,4 +8,5 @@ import type { JSONSchema7 } from 'json-schema';

readonly quiet?: boolean;
readonly maxSampleDepth?: 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