swagger-to-flowtype icon indicating copy to clipboard operation
swagger-to-flowtype copied to clipboard

Allows swagger types like

Open tmowad opened this issue 6 years ago • 5 comments

type:

  • 'null'
  • T to be translated to a flowtype of ?T

tmowad avatar Jun 08 '18 20:06 tmowad

It looks like some of your comment was lost. I'm guessing that you had something between angle braces and the Markdown interpreter thought you were trying to insert HTML, and rejected the HTML. This is something you could guard by surrounding your entire identifiers with backticks (`).

LoganBarnett avatar Jun 14 '18 19:06 LoganBarnett

@tmowad Could you fill the missing description?

yayoc avatar Jun 15 '18 00:06 yayoc

@yayoc sorry about that, I had open-close tags around the T, now it just says T.

In short, the change allows us to take a type which has swagger allowed type of ["null" or (BlahType)], to be converted to a flowtype of ?BlahType.

tmowad avatar Jun 19 '18 17:06 tmowad

Thanks for comments. @tmowad
I guess that OpenAPI 2.0 does not support null as the data type, It's supported on JSON scheme spec.

And also Swagger 3.0 doc notes about null type like below

OpenAPI 3.0 does not have an explicit null type as in JSON Schema, but you can use nullable: true to specify that the value may be null.

In OpenAPI 3.0, we can check nullable value to specify optional.

yayoc avatar Jun 22 '18 09:06 yayoc

@yayoc thanks for looking into that. Interestingly, a tool we're using (Stoplight.io) seems to allow this null type (but its 'null' not null) - am digging in and trying to figure out if this is some hack/workaround or if its somehow legitimate. Will update when I have more understanding.

(edit: And this is with OpenAPI 2.0 just FYI)

tmowad avatar Jun 25 '18 19:06 tmowad