
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
swagger-to-flowtype
Advanced tools
swagger-to-flowtype
is a tool for generating type definitions of Flow from swagger file.
npm i -g swagger-to-flowtype
$swagger-to-flowtype <YOUR SWAGGER FILE OR URL>
This command generates a file named flowtype.js includes type definitions as default.
Specify an output path
You can also specify an output path with -d option
.
$swagger-to-flowtype <YOUR SWAGGER FILE PATH OR URL> -d <OUTPUT FILE PATH>
Supporting Maybe type
If you pass a --check-required
option, swagger-to-flowtype
will check required field
on your swagger file, then output flow definitions with Maybe type.
"NewPet": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
}
will be
export type NewPet = {
name: string,
tag?: string
}
Transform property key to lower camel case
--lower-camel-case
option transforms each property keys to lower camel case.
"Cat": {
"type": "object",
"properties": {
"long_long_key": {
"type": "string"
}
}
}
will be
export type Cat = { longLongKey?: string };
swagger file like following
...
definitions:
Order:
type: "object"
properties:
id:
type: "integer"
format: "int64"
petId:
type: "integer"
format: "int64"
quantity:
type: "integer"
format: "int32"
shipDate:
type: "string"
format: "date-time"
status:
type: "string"
description: "Order Status"
enum:
- "placed"
- "approved"
- "delivered"
complete:
type: "boolean"
default: false
xml:
name: "Order"
Category:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
xml:
name: "Category"
...
Output will be like below
// @flow
export type Order = {
id: number,
petId: number,
quantity: number,
shipDate: string,
status: 'placed' | 'approved' | 'delivered',
complete: boolean
};
export type Category = { id: number, name: string };
Node 4+ is required
npm test
FAQs
Command line tool for generating flow types from swagger
The npm package swagger-to-flowtype receives a total of 43 weekly downloads. As such, swagger-to-flowtype popularity was classified as not popular.
We found that swagger-to-flowtype 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
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.