Create OpenAPI (Swagger) Documentation

The idea is:

It is common to use n8n.io to build REST APIs. Often APIs are documented using Open API (Swagger). It would be great if the Webhook Node had the ability to create Open API documentation which could be served from n8n.io.

My use case:

I have created a Webhook to service GET /airports/:airport_code HTTP Requests. I download the Workflow .json file,

I asked ChatGPT to analyse the workflow JSON and write me an Open API Spec, using the prompt “given this n8n.io Workflow which defines an API endpoint. Can you write an OpenAPI v3 spec so I can document it”.

ChatGPT created a pretty good Open API spec in YAML.

I then created a Webhook which responded with this YAML.
I then create another Webhook which responded with boilerplate HTML and JS which rendered the Open API Spec.

I think it would be beneficial to add this because:

It is imperative that APIs are well documented.

Any resources to support this?

https://editor.swagger.io/

Are you willing to work on this?

Unfortunately, no.

Hi Russell,
I came across your description of creating and documenting an API endpoint using n8n.io, and it’s really insightful. Specifically, I’m intrigued by how you utilized a Webhook to generate and serve an OpenAPI spec, as well as the HTML and JS rendering.

I’m currently exploring similar functionality and would like to try this implementation on my setup. Could you kindly share the workflow.json file you used? This would help me better understand the process and replicate it effectively.

Hi Rohan, did you made something automatically to generat OpenAPI schemas?

I wonder if code like MCPO could easily convert node action information into a schema? MCPO converts MCPs into HTTP endpoints, serving an OpenAPI.json. I would love to see n8n do this.