Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@stoplight/json-schema-sampler
Advanced tools
Tool for generation samples based on JSON Schema Draft 7
It's a fork of openapi-sampler by Redocly, with focus on supporting JSON Schema Draft 7.
Tool for generation samples based on JSON Schema Draft 7.
allOf
, oneOf
, anyOf
, if/then/else
additionalProperties
default
, const
, enum
and examples
where possiblecontains
, minItems
, maxItems
, and tuples (items
as an array)minLength
, maxLength
, min
, max
, exclusiveMinimum
, exclusiveMaximum
string
formats:
$ref
resolvingInstall using npm
npm install @stoplight/json-schema-sampler --save
or using yarn
yarn add @stoplight/json-schema-sampler
Then require it in your code:
const JSONSchemaSampler = require('@stoplight/json-schema-sampler');
JSONSchemaSampler.sample(schema, [options], [spec])
object
A JSON Schema Draft 7 document.object
Available options:
boolean
Don't include non-required object properties not specified in required
property of the schema objectboolean
Don't include readOnly
object propertiesboolean
Don't include writeOnly
object propertiesboolean
Don't log console warning messagesnumber
Max depth sampler should traverseschema
passed is only a portion of the whole schema and $refs aren't resected. doc must not contain any external referencesconst JSONSchemaSampler = require('@stoplight/json-schema-sampler');
JSONSchemaSampler.sample({
type: 'object',
properties: {
a: {type: 'integer', minimum: 10},
b: {type: 'string', format: 'password', minLength: 10},
c: {type: 'boolean', readOnly: true}
}
}, {skipReadOnly: true});
// { a: 10, b: 'pa$$word_q' }
[0.3.0]
SchemaSizeExceededError
to handle when an example response can't be generated because it's too largeFAQs
Tool for generation samples based on JSON Schema Draft 7
The npm package @stoplight/json-schema-sampler receives a total of 110,339 weekly downloads. As such, @stoplight/json-schema-sampler popularity was classified as popular.
We found that @stoplight/json-schema-sampler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 26 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.