
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
fast-fast-typescript-to-jsonschema
Advanced tools
fast-typescript-to-jsonschema generates JSON Schema files from your Typescript sources.
生成typescript类型的jsonschema数据
yarn add fast-typescript-to-jsonschema -D
type.ts
文件,内容如下:interface ITest {
attr1: string;
attr2: number;
attr3?: boolean;
}
test.js
文件,内容如下:const { default: genTypeSchema } = require('fast-typescript-to-jsonschema');
const path = require('path');
// 目标文件
const file = path.resolve(__dirname, './type.ts');
// 生成数据
genTypeSchema.genJsonDataFormFile(file);
// 获得当前文件对应的所有jsonschema数据
const json = genTypeSchema.genJsonData();
// 获得具体的某个type的jsonschema数据
const jsonSchema = genTypeSchema.getJsonSchema(file, 'ITest');
// 返回结果
console.log(jsonSchema);
node ./test.js
jsonSchema
返回结果如下:
{
"additionalProperties": false,
"properties": {
"attr1": {
"type": "string",
},
"attr2": {
"type": "number",
},
"attr3": {
"type": "boolean",
},
},
"required": [
"attr1",
"attr2",
],
"type": "object",
}
示例1
interface Interface_1 {
attr: string;
}
结果:
{
"additionalProperties": false,
"properties": {
"attr": {
"type": "string",
},
},
"required": [
"attr",
],
"type": "object",
}
示例2
interface Interface_4 {
attr: string[];
}
结果:
{
"additionalProperties": false,
"properties": {
"attr": {
"items": {
"type": "string",
},
"type": "array",
},
},
"required": [
"attr",
],
"type": "object",
}
更多支持的类型解析请看,目录如下:
我们非常欢迎您的贡献,您可以通过以下方式与我们共建。
FAQs
fast-typescript-to-jsonschema generates JSON Schema files from your Typescript sources.
The npm package fast-fast-typescript-to-jsonschema receives a total of 0 weekly downloads. As such, fast-fast-typescript-to-jsonschema popularity was classified as not popular.
We found that fast-fast-typescript-to-jsonschema 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.