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.
@anttiviljami/dtsgenerator
Advanced tools
TypeScript d.ts file generator from JSON Schema file or OpenAPI(Swagger) spec file.
npm install -g dtsgenerator
$ dtsgen --help
Usage: dtsgenerator [options] <file ... | file patterns using node-glob>
Options:
-V, --version output the version number
-c, --config <file> set configuration file path.
--url <url> input json schema from the url. (default: [])
--stdin read stdin with other files or urls.
-o, --out <file> output filename.
-t, --target <version> Specify ECMAScript target version: 'ES3', 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018',
'ES2019', 'ES2020', or 'ESNEXT' (default).
--info for developer mode. output loaded config and plugin details only.
--output-ast output TypeScript AST instead of d.ts file.
-h, --help display help for command
Examples:
$ dtsgen --help
$ dtsgen --out types.d.ts schema/**/*.schema.json
$ cat schema1.json | dtsgen -c dtsgen.json
$ dtsgen -o swaggerSchema.d.ts --url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v2.0/schema.json
$ dtsgen -o petstore.d.ts --url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/yaml/petstore.yaml
$ dtsgen -c dtsgen-test.json --info
const { default: dtsgenerator, parseSchema } = require('dtsgenerator');
dtsgenerator({
contents: [parseSchema({/* JsonSchema object */})],
config: {/* Config object */},
}).then(content => {
/* Do someting with parsed content */
}).catch(err => {
/* Handle errors */
});
If you need a proxy to fetch the schema, please set the following environment variables.
export http_proxy=http://proxy.example.com:8080/
export https_proxy=http://proxy.example.com:8080/
# If there are exceptionally hosts that do not go through a proxy
export no_proxy=google.com, yahoo.com
The dtsgenerator v3 has made the following braking changes from v2.
--namespace
option. Use the @dtsgenerator/replace-namespace
plug-in instead.--config
option. Mainly for setting up the Plug-in.@dtsgenerator/replace-namespace
: This plug-in is instead the --namespace
option on old version.@dtsgenerator/decorate-typename
: This plug-in can decorate the output type name.@dtsgenerator/single-quote
: This plug-in replace the quote mark to single.npm init @dtsgenerator **plugin-name**
**plugin-name**/index.ts
npm test
npm run build
npm publish
Output debug message by debug library.
$ DEBUG=dtsgen dtsgen schema/news.json
JSON Schema
OpenAPI
file
by #496. Thank you @Christian24 :+1:readOnly
property, because of wrong interpretation by #498. Thank you @hallsbyra :+1:unknown
keyword by #488. Thank you @medfreeman :+1:content
property in Parameters
by #472. Thank you for report @npdev453 :+1:oneOf
& anyOf
keywords by #486. Thank you @medfreeman :+1:generate
function to use recommended immutable approach for typescript transforms by #483. Thank you again @medfreeman :+1:mergeSchema
by #474. Thank you @ricokahler :+1:void
type support by #468. Thank you for your propose @henhal by #445 :+1:ts
object for to use the same version TypeScript in all plugins by #465.patternProperties
by #436. Thank you @nfroidure :+1:prettier
config on .eslintrc.json
.dtsgenerator
is licensed under the MIT license.
Copyright © 2016-2020, Hiroki Horiuchi
FAQs
TypeScript d.ts file generator for JSON Schema file
The npm package @anttiviljami/dtsgenerator receives a total of 7,861 weekly downloads. As such, @anttiviljami/dtsgenerator popularity was classified as popular.
We found that @anttiviljami/dtsgenerator 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
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.