How to model API to generate oneOf relationship in openapi?

Hi, I’m modeling API first and want to generate swagger/openapi specification.

I have one attribute “blocks” in Layout class - it is an array of interface call it “IBlock” - it has some attributes. and I modeled few objects that are implementing that interface, using Generalizatin relationship, like “BasicBlock”, “BetterBlock”, etc…

So I have Association relationship between Layout → IBlock with blocks = array of IBlocks. It generates the array of IBlocks, but doesn’t see/use any of the implemented types, and I want IBlocks to have generated “oneOf” - BasicBlock, BetterBlock,…
That

How can I correctly specify relationships to get “oneOf” in openapi yaml?
Is it possible to add oneOf in yaml and reverse import it from yaml into vpp?

Thank you.

Thank you for your inquiry. I’m sorry that at the moment we do not support model the “oneOf” generalization for API generation. We will consider to support this in our future release. I’ll keep you post once there are any update on it.

1 Like

Okay, thank you for quick reply. So how would you advice to easily solve it - go around? Model it as generalization but at the same time - when the classes are not generated in the yaml output - make some dummy class and associate it with that dummy class just for the purpose of generating? Or do you plan to add into generating algorithm, that everything what has some kind of connection will be generated? It’s just non intuitive, that none of the few objects generated at all.

Besides great tool! I see that you are improving the app tremendously, keep up the good work, its getting quite big and more and more useful.