oas-tools icon indicating copy to clipboard operation
oas-tools copied to clipboard

fixNullable() is recursively updating types

Open stephenbeauchamp opened this issue 5 years ago • 3 comments

There is a helper function: src/lib/utils.js > fixNullable(schema)

It scans for nullable properties and converts their type from type: 'xyz' to type: [ 'xyz', "null" ]

Very helpful! Thanks for fixing that! But there is an issue.

If this is run over the schema more than once, then subsequent runs you get: type: [ ['xyz', "null"], "null" ] type: [ [ ['xyz', "null"], "null" ], "null"] type: [ [ [ ['xyz', "null"], "null" ], "null"], "null"]

I suggest we test that the conversion hasn't already been done before running the fix up.

stephenbeauchamp avatar Sep 21 '20 05:09 stephenbeauchamp

Sorry, I logged an issue so I would have a sensible branch name for the PR .... I see the PR creates it's own issue, so this is a duplicate of #254 - and has the wrong branch name!

stephenbeauchamp avatar Sep 21 '20 07:09 stephenbeauchamp

When can we expect a new release? I'm kinda needing this bug to be fixed ASAP.

Hippo0o avatar Feb 05 '21 09:02 Hippo0o

I also need it ASAP... Would be nice if the next release can be done soon!

lupus92 avatar May 26 '21 09:05 lupus92

fixNullable() is no longer used in the new version of OAS Tools. As of v3.0.2 nullable values are parsed correctly.

alesancor1 avatar Sep 26 '22 11:09 alesancor1