swagger-to-flowtype
swagger-to-flowtype copied to clipboard
Allows swagger types like
type:
- 'null'
- T to be translated to a flowtype of ?T
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 (`).
@tmowad Could you fill the missing description?
@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.
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 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)