Generate Swagger/OpenAPI document from schema
An extremely common task for me is to create a REST API for a collection in a MongoDB database.
For me, this involves creating a Swager/OpenAPI document that describes both "sides" of the API. For the most part this corresponds almost exactly to the schema of the documents in a collection and the set queries I use to retrieve them.
It seems to me that it would be possible (and relatively easy) to generate a schema from a collection and filter it into a Swagger/OpenAPI yaml file. It would be a great starting point for building the REST API. It also seems possible to add similar entries to the file example query JSON.
1
vote
![](https://secure.gravatar.com/avatar/2d9244647d1e5fef68f0a854a12b6868?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)