
Research
Namastex.ai npm Packages Hit with TeamPCP-Style CanisterWorm Malware
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.
json-schema-to-typescript-with-deps
Advanced tools
Compile JSON Schema to TypeScript typings.
Note: This is a fork of
json-schema-to-typescriptwhose intention is to support the usedependencieswithin JSON schemas. Right now the fork supports them when used in combination withoneOfand may not actually support other use-cases currently.
Check out the live demo.
Input:
{
"title": "Example Schema",
"type": "object",
"properties": {
"occupation": {
"enum": ["farmer", "other"]
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
},
"hairColor": {
"enum": ["black", "brown", "blue"],
"type": "string"
}
},
"dependencies": {
"occupation": {
"oneOf": [
{
"properties": {
"occupation": {
"enum": ["farmer"]
}
},
{
"required": ["jobDescription"],
"properties": {
"occupation": {
"enum": ["other"]
},
"jobDescription": {
"type": "string"
}
}
}
}
]
}
},
"additionalProperties": false,
"required": ["firstName", "lastName", "occupation"]
}
Output:
export type ExampleSchema = ExampleSchema1 & {
firstName: string;
lastName: string;
occupation: "farmer" | "other"
/**
* Age in years
*/
age?: number;
hairColor?: "black" | "brown" | "blue";
}
export type ExampleSchema1 =
| {
occupation?: "farmer"
}
| {
occupation?: "other",
jobDescription: string
}
npm install json-schema-to-typescript-with-deps
json-schema-to-typescript is easy to use via the CLI, or programmatically.
First make the CLI available using one of the following options:
# install locally, then use `npx json2ts`
npm install json-schema-to-typescript-with-deps
# or install globally, then use `json2ts`
npm install json-schema-to-typescript-with-deps --global
# or install to npm cache, then use `npx --package=json-schema-to-typescript-with-deps json2ts`
# (you don't need to run an install command first)
Then, use the CLI to convert JSON files to TypeScript typings:
cat foo.json | json2ts > foo.d.ts
# or
json2ts foo.json > foo.d.ts
# or
json2ts foo.yaml foo.d.ts
# or
json2ts --input foo.json --output foo.d.ts
# or
json2ts -i foo.json -o foo.d.ts
# or (quote globs so that your shell doesn't expand them)
json2ts -i 'schemas/**/*.json'
# or
json2ts -i schemas/ -o types/
You can pass any of the options described below (including style options) as CLI flags. Boolean values can be set to false using the no- prefix.
# generate code for definitions that aren't referenced
json2ts -i foo.json -o foo.d.ts --unreachableDefinitions
# use single quotes and disable trailing semicolons
json2ts -i foo.json -o foo.d.ts --style.singleQuote --no-style.semi
See the original repo for more usage and API examples.
FAQs
compile json schema to typescript typings
The npm package json-schema-to-typescript-with-deps receives a total of 17 weekly downloads. As such, json-schema-to-typescript-with-deps popularity was classified as not popular.
We found that json-schema-to-typescript-with-deps demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Research
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.