JSON Flow CLI
Generate flow types from JSON streams without any schemas.
Installation
npm install json-flow-cli -g
Usage
cat some-json-file.json | json-flow-cli --name=SomeFlowTypeName
curl http://some-web-api/json-response | json-flow-cli --name=SomeFlowTypeName
Options:
--name={schema} Used to generate the name of your flow types (required).
--help Displays this help.
Example
Input
Run json-flow-cli against the above input:
cat src/test-files/foo.json | json-flow-cli --name Simple > foo.output
Output
type Simple = somePropA: SimpleSomePropA; type SimpleSomePropA = somePropB: SimpleSomePropASomePropB SomeOtherPropC: Array<SimpleSomePropASomeOtherPropC>; type SimpleSomePropASomePropB = someOtherPropA: number someOtherPropB: number; type SimpleSomePropASomeOtherPropC = somePropD: SimpleSomePropASomeOtherPropCSomePropD; type SimpleSomePropASomeOtherPropCSomePropD = somePropE: object;