Forum Discussion

dnordahl's avatar
dnordahl
New Contributor
5 years ago

Generate swagger/openAPI definition from existing web service?

My goal is to simulate/mock an existing REST web service which was developed in VS Code.  I see that SwaggerHub and other tools like SoapUI are able to generate a mock via Swagger/OpenAPI or WADL definition files that other applications can interact with (in substitution of the real service).  

 

Is there anyway to generate a Swagger/OpenAPI or WADL definition file from either a VS Code project, or from a deployed version of a REST web service? 

 

So far the two options I've found are to either define the request methods in a SoapUI project and verify them against a deployment of a webservice (and then be able to generate a definition file or mock from that project).  Or to use a tool that monitors a port while a client interacts with a REST service, and maps out what it sees occurring. Both of these methods seem a bit slow and cumbersome, so I was wondering if there's any more efficient method.  

 

Since I don't see too many people asking this question on various forums, and since I don't see tools really advertising this functionality, maybe I'm missing a fundamental understanding of how formal definitions for REST services work in thinking this should exist.  Maybe this is a complex language/implementation dependent to solve which doesn't have any easy solutions. (Or maybe I'm searching for the wrong keywords).