grape-swagger icon indicating copy to clipboard operation
grape-swagger copied to clipboard

Support for inheritance: subTypes and discriminator.

Open harmoney-danc opened this issue 9 years ago • 3 comments

Hello, is there any support for describing inheritance in the generated swagger specification? According to Swagger 1.2 specification, this should be possible through the use of subTypes and discriminator.

I have an API that retrieves/updates account information. The Account model is abstract and I have concrete BusinessAccount and IndividualAccount models (they have some of the fields in common).

What options do I have for achieving this? I would like input to be validated according to the type of account and output to only present the fields pertaining to the type of account at hand (for output I use grape-entity).

Regards, Dan

harmoney-danc avatar Jun 22 '15 23:06 harmoney-danc

This is currently not supported => feature request.

dblock avatar Jun 22 '15 23:06 dblock

I have noticed that the Swagger 2.0 specification has changed a little bit in respect of how inheritance is described. Are there any plans to move to 2.0 in the near future?

dan-corneanu avatar Jun 22 '15 23:06 dan-corneanu

See https://github.com/tim-vandecasteele/grape-swagger/issues/219 - I'd really like https://github.com/tim-vandecasteele/grape-swagger/issues/137 first.

dblock avatar Jun 23 '15 13:06 dblock