JKHeadley / JKHeadley/rest-hapi
Add support for polymorphism (discriminators)
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 155
- PR merge metrics
- No merged PRs in 30d
Description
I need to be able to leverage the polymorphism features of [Mongoose (discriminators)](https://mongoosejs.com/docs/discriminators.html) to create schemas that inherit from one another (example: Contract, SalesContract, PurchaseContract)
Enhance the model and api generators to support discriminators. Leverage [Swagger's support of OneOf](https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/) for generation of api and documentation.
There are unfortunately no acceptable alternatives at the moment.
Btw, thank you for this awesome library, it's a true time saver.
Cheers,
Anthony
Contributor guide
Research direction
Start by tracing the model and API generator entry points and reading the linked Mongoose discriminator and Swagger OneOf documentation. Determine how inherited schemas should be represented in generated APIs and documentation, then verify that Contract, SalesContract, and PurchaseContract can be generated with the intended polymorphic relationships.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend, documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100