apiconnect-example-generator

API Connect Example Generator

Usage no npm install needed!

<script type="module">
  import apiconnectExampleGenerator from 'https://cdn.skypack.dev/apiconnect-example-generator';
</script>

README

APIConnect Example Generator

Description

This module is used to generate example objects from OpenAPI document contents. It is used by API Designer, API Manager, API Explorer and the Developer Portal.

It provides three functions:

  • 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

Development

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.