APIConnect Example Generator
This module is used to generate code snippets and example objects from OpenAPI document contents. It is used by API Designer, API Manager, API Explorer and the Developer Portal.
It provides four functions:
generateCodeSnippets- generate a set of code snippets for various languages which demonstrate invoking a given operation.
generateExampleResponse- generates an example response object for the given operation by looking for schema definitions first for a 200 response, then a 201 response, and finally a default response.
generateExampleparameter- generates an example parameter for the given operation parameter, optionally supplying a content type (XML or JSON), and also optionally beautifying the response for readability.
createDummyValue- generates a dummy value given a schema and key
There are some manual test files provided which can be useful to run example generator tests manually in a browser.
Simply make your changes to the code, then run:
npm run-script devel. That will build a debug version of example generator which has not been minimised. You can then open one of the manual test files in your browser and use the browser debugger to see whats going on.