OpenAPITypeProvider icon indicating copy to clipboard operation
OpenAPITypeProvider copied to clipboard

oneOf/anyOf workaround

Open cmeeren opened this issue 6 years ago • 2 comments

I'm considering using this TP, but I need to know a little bit more about how it handles oneOf/anyOf.

The readme states that oneOf and anyOf (well, it says manyOf, but that's an error, it should be anyOf) are not supported. But what happens when the TP encounters these in an OpenAPI document? Can it parse the document at all?

If the TP gives an error when encountering these, then that's a show-stopper for using this TP, because any API provider may add oneOf/anyOf at any time, rendering this TP suddenly useless for that API and requiring a massive rewrite of client code.

A workaround could be that oneOf and anyOf can be treated as allOf, except that everything is optional. Then at least you have the possibility to use the TP for documents that have oneOf/anyOf; you'd just have to make sure that you use a valid combination of properties.

cmeeren avatar Mar 25 '19 09:03 cmeeren

Hi, it is based on OpenAPIProvider where oneOf / anyOf is not supported yet - https://github.com/Dzoukr/OpenAPIParser/blob/master/src/OpenAPIParser/Version3/Specification.fs. I think having such thing in yaml will just be ignored.

Dzoukr avatar Mar 25 '19 12:03 Dzoukr

Thanks, opened an issue here: https://github.com/Dzoukr/OpenAPIParser/issues/2

cmeeren avatar Mar 25 '19 13:03 cmeeren