Skip to content

Support for discriminator / subType polymorphism #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RobBlairInq opened this issue Dec 2, 2013 · 7 comments
Closed

Support for discriminator / subType polymorphism #116

RobBlairInq opened this issue Dec 2, 2013 · 7 comments

Comments

@RobBlairInq
Copy link
Contributor

This is a doozy of a feature request:

It would be fabulous to support the discriminator / subType pattern in the generated code.
see https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#527-model-object for info

This probably involves lots of work.

" Models can now contain a subTypes attribute which indicate that models are a subtype another. It is assumed that the subclass contains the union of properties between itself and its superclass

Models can contain a discriminator field which, in conjunction with a subTypes, can be used for polymorphic models."

@devmage
Copy link

devmage commented May 16, 2014

👍 to this, please! It's quite awkward for the published spec to describe polymorphism as such, only to find that it isn't supported in codegen.

@RobBlairInq
Copy link
Contributor Author

@devmage
Copy link

devmage commented Jun 6, 2014

Yes, it's in the documentation. The problem is with codegen, which doesn't yet support this published feature.

@RobBlairInq
Copy link
Contributor Author

Just updating the request to point to the current documentation.

the hard part (in java at least) is that we'd need separate model.mustache files for base class vs subclass. Then have some dynamic .mustache that handles the unpacking of the classes to the proper subclass. (and sadly my API I'm working with that has polymorphisms does not honor the discriminator style in swagger, needing some alternate mapping scheme.)

@weichsl
Copy link

weichsl commented Jul 22, 2014

Hi guys,

I'm currently working on an API model which would need that feature included in swagger-codegen. Do you have any idea as to when swagger-codegen will be working with polymorphism?

Thx a lot

@fehguy
Copy link
Contributor

fehguy commented Jul 24, 2014

Hi Christian, it’s likely going to go into the next major rev of the codegen, which is more than a couple weeks away.
-- 
Tony Tam
Sent with Airmail 

On July 22, 2014 at 8:28:02 AM, Christian Weichselbaum ([email protected]) wrote:

Hi guys,

I'm currently working on an API model which would need that feature included in swagger-codegen. Do you have any idea as to when swagger-codegen will be working with polymorphism?

Thx a lot


Reply to this email directly or view it on GitHub.

@fehguy
Copy link
Contributor

fehguy commented Dec 24, 2014

see #358 this will be supported in 2.1.0-M2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants