anil614sagar / openapi2apigee

OpenAPI to Apigee API Proxy using Node.js Utility
MIT License
33 stars 45 forks source link

Mock Responses? #13

Closed nemec closed 8 years ago

nemec commented 8 years ago

What are your thoughts on adding an option to generate mock responses based on samples in the Swagger spec? If your backend API is still in development, the mocks would let clients build their app at the same time with accurate, if static, responses. Once your API is ready, you can remove the mocks and the clients will automatically hit the real API.

As far as implementation goes, the best approach I can think of is to bundle a Node.js TargetEndpoint alongside the backend that's configured to serve the correct JSON/XML based on the incoming path. An extra RouteRule would route to the mock server by default, but users could add a conditional in Apigee to skip the mock and route to the real backend if they choose.

I still haven't figured out if it's possible to upload JSON/XML resource files to Apigee alongside the Node server (and reference them from the server) or if I'd need to embed the responses in JS strings in the code.

anil614sagar commented 8 years ago

@nemec

Unfortunately, We will not be doing abive feature here. Check out Swagger Node (A127) project which does exactly same. https://github.com/apigee-127/a127 , https://github.com/swagger-api/swagger-node