Skip to content
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

Support for mongoose model definitions #46

Closed
maxiejbe opened this issue Apr 5, 2020 · 7 comments
Closed

Support for mongoose model definitions #46

maxiejbe opened this issue Apr 5, 2020 · 7 comments

Comments

@maxiejbe
Copy link
Contributor

maxiejbe commented Apr 5, 2020

In order to have mongoose model definitions, it could be pretty useful to integrate a library such as:

Matching route requests/responses with model definitions must be hard to implement.
Just a read-only implementation would be great!

An interface like this could work:

expressOasGenerator.handleResponses(server, {
    specMongooseModelsPath: './models',
    specMongooseIncludeModels: ['User', 'Blog', ...],    
});

Thanks in advance!

@kiprasmel
Copy link
Contributor

Hey there, thanks for the request(s)!

I'm afraid that I and the owner don't have much time available right now to implement this:/ If you (or anyone else) would like to try to implement this & create a PR - we'd gladly accept!

@maxiejbe
Copy link
Contributor Author

@sarpik Thanks for your reply. Sure, will give it a try! 😄

@JeffJassky
Copy link

@maxiejbe Any chance you decided to take that on? I was looking for the same thing :)

@maxiejbe
Copy link
Contributor Author

@maxiejbe Any chance you decided to take that on? I was looking for the same thing :)

Not yet, but planning to start soon!

@maxiejbe
Copy link
Contributor Author

Hi everyone!
Here's the PR: #61.
This is my first time contributing to this repository, wanna take a look @kiprasmel @mpashkovskiy ?
Thanks!

@mpashkovskiy
Copy link
Owner

Hey @maxiejbe thanks for PR! I reviewed it.

mpashkovskiy pushed a commit that referenced this issue Jul 29, 2020
* Including mongoose-to-swagger dependency

* Including mongoose as peer dependency

* Mongoose and bson as dev dependencies

* Helper to generate mongoose models spec

* Adjusting test description for existing mongoose model

* Generic test for mongoose model spec

* Setting mongoose model specs as oas definitions

* Single test for oas definitions from mongoose models

* Updating readme to include mongooseModels init param

* Including mongooseModels arg on handleResponses

* Updating existing examples with mongoose models

* Updating definitions spec function signature

* Refactor on spec.definitions assignment

* Removing exception wrapper from generateMongooseModelsSpec

* Adjusting  generateMongooseModelsSpec test to use expect.toThrowError()

* Returning void on updateDefinitionsSpec

* Making bson, mongoose and mongoose-to-swagger peer dependencies

* Adjusting peer dependencies comments
@mpashkovskiy
Copy link
Owner

PR is merged, new version is on the way

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