Open MartinMuzatko opened 3 years ago
That would be a great feature
Hi there, has anyone been working on this ? If not I could give it a try 🙂
@codams can you start with this? How can I help you?
Might the following project be of any use express-oas-generator (EOG)?:
How does it work?
- During initialisation module iterates through all routes and methods and initialises OpenAPI (Swagger) specification.
- After an application start module analyse every request/response and fills specification with schemes and examples.
- Module replace values of password fields with **
So EOG seems to be a set of Express middleware that can invoke and document Express server routes and generate OpenAPI documentation out of a json-server instance.
I haven't used this in anger myself, I was merely investigating getting a Swagger/OpenAPI spec out of an updated json-server API, your mileage may vary.
At a minimum, it should be possible to integrate this middleware readily into code embedding a json-server-express instance, in your own personal projects, although a new CLi option, employing this, might not be too difficult to develop, either.
It might also be possibly use the --middlewares, -m CLi option of json-server to simply pass your own my-oas-middleware.js
implementing file, containing references to EOG. I'm not too sure about any potential import resolution issues (I'm new to json-server).
Hi! I'm building a layer on top of json-server to dynamically add new lists (arrays) to the json file. It would be nice to generate a Swagger/OpenAPI documentation based on the plural/singular router settings.
Since the json-server is dynamic, this should be a function provided to generate the spec