Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/loyd/flow2schema
Generate json-schemas for flowtype definitions
https://github.com/loyd/flow2schema
avro avsc flow flowtype json-schema
Last synced: 8 days ago
JSON representation
Generate json-schemas for flowtype definitions
- Host: GitHub
- URL: https://github.com/loyd/flow2schema
- Owner: loyd
- Created: 2017-10-28T22:53:32.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-24T17:26:10.000Z (about 5 years ago)
- Last Synced: 2024-10-14T02:23:11.381Z (23 days ago)
- Topics: avro, avsc, flow, flowtype, json-schema
- Language: JavaScript
- Homepage:
- Size: 198 KB
- Stars: 20
- Watchers: 4
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# flow2schema
[![Version npm](https://img.shields.io/npm/v/flow2schema.svg)](https://www.npmjs.com/package/flow2schema)
[![Linux Build](https://travis-ci.org/loyd/flow2schema.svg?branch=master)](https://travis-ci.org/loyd/flow2schema)
[![Windows Build](https://ci.appveyor.com/api/projects/status/github/loyd/flow2schema?branch=master&svg=true)](https://ci.appveyor.com/project/loyd/flow2schema)
[![Coverage Status](https://coveralls.io/repos/github/loyd/flow2schema/badge.svg?branch=master)](https://coveralls.io/r/loyd/flow2schema?branch=master)## Example
```sh
$ cat example.js
```
```js
type A = {
t: T,
k: K,
};export type X = {
a: A,
b: number,
};
``````sh
$ flow2schema -t json-schema example.js
``````json
{
"$schema": "http://json-schema.org/draft-06/schema#",
"definitions": {
"example::A::string::boolean": {
"type": "object",
"properties": {
"t": {"type": "string"},
"k": {"type": "boolean"}
},
"required": ["t", "k"]
},
"example::X": {
"type": "object",
"properties": {
"a": {"$ref": "#/definitions/example::A::string::boolean"},
"b": {"type": "number"}
},
"required": ["a", "b"]
}
}
}
```## TODO
* Complete generics support.
* Errors and warnings.
* Complete commonjs support.
* Documentation.
* Stabilize API.
* Webpack plugin.
* Rollup plugin.