PassFort / json-schema-to-flow-type

69 stars 17 forks source link

Support union types #3

Closed dannynelson closed 7 years ago

dannynelson commented 7 years ago

A json schema supports defining union types:

{"type": ["string", "number"]}

This should convert to a flow union type:

string | number
morlay commented 7 years ago

It already supported. https://github.com/morlay/json-schema-to-flow-type/blob/master/src/FlowSchema.js#L145

At least for simple schema.

parseSchema({
    id: "Test",
    type: [ "string", "number" ],
});

will be

export type Test = string | number;
morlay commented 7 years ago

BTW, I am giving up Flow.js and moving to TypeScript. flow-bin is really slow and flow-typed make me crazy.

So I am not sure I can continue maintain this package without focusing Flow.js. Could you take over this package?

dannynelson commented 7 years ago

@morlay ok, I will come up with a more specific test to reproduce.

Yes, my company, goodeggs, can take over the module. Can you also add goodeggs as an owner of the npm package?

morlay commented 7 years ago

Cool,I can't transfer to goodeggs, so to you first. npm added goodeggs. Thanks ~

dannynelson commented 7 years ago

Great, thanks!