Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
schematized
Advanced tools
Turn JS objects into JSON schemas that continue to improve as you provide examples.
Turn JS objects into JSON schemas that continue to improve as you provide examples.
A Node port of the Python module Genson.
yarn add schematized
import { SchemaBuilder } from 'schematized' // Typescript & ES6+
const { default: SchemaBuilder } = require('schematized') // CommonJS
const builder = new SchemaBuilder()
// Consume JSON
builder.addObject({
token: '74aea1a53d68b77e4f1f55fa90a7eb81',
role: ['Basic'],
})
// Produce JSON Schemas!
const schema = builder.toSchema()
...
// Add more example objects
builder.addObject({
token: 'Bearer 6498d9afc96d1d8d881a2b7ded4f9290',
role: [
'Admin',
'Basic',
'Publisher'
]
})
// Or combine data from another JSON Schema
builder.addSchema({
title: '/user response',
description: 'User data from server.'
})
Schema from the single example:
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"token": {
"type": "string",
"maxLength": 32,
"minLength": 32
},
"role": {
"type": "array",
"items": {
"type": "string",
"maxLength": 5,
"minLength": 5
}
}
},
"required": [
"role",
"token"
]
}
Schema from the two examples:
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"token": {
"type": "string",
"maxLength": 39,
"minLength": 32
},
"role": {
"type": "array",
"items": {
"type": "string",
"maxLength": 9,
"minLength": 5
}
}
},
"required": [
"role",
"token"
]
}
Schema from the two examples and the schema:
{
"$schema": "http://json-schema.org/schema#",
"title": "/user response",
"description": "User data from server.",
"type": "object",
"properties": {
"token": {
"type": "string",
"maxLength": 39,
"minLength": 32
},
"role": {
"type": "array",
"items": {
"type": "string",
"maxLength": 9,
"minLength": 5
}
}
},
"required": [
"role",
"token"
]
}
FAQs
Turn objects into JSON schemas! The more examples you provide, the better your schema will be.
The npm package schematized receives a total of 1 weekly downloads. As such, schematized popularity was classified as not popular.
We found that schematized demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
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.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.