
Product
A New Overview in our Dashboard
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
@api-components/api-example-generator
Advanced tools
API examples generator from the AMF model.
This version only works with AMF model version 2 (AMF parser >= 4.0.0).
For compatibility with previous model version use 3.x.x
version of the component.
npm install --save @api-components/api-example-generator
This components is a part of API components ecosystem
<html>
<head>
<script type="module">
import '@api-components/api-example-generator/api-example-generator.js';
</script>
</head>
<body>
<api-example-generator></api-example-generator>
</body>
</html>
import { LitElement, html } from 'lit-element';
import '@api-components/api-example-generator/api-example-generator.js';
class SampleElement extends LitElement {
render() {
return html`
<api-example-generator .amf="${this.model}"></api-example-generator>
`;
}
}
customElements.define('sample-element', SampleElement);
Use listMedia()
which accespts list of payloads or a single payload definition.
Use generatePayloadsExamples()
to genmerate a list of examples for payload(s).
Provide second argument which is a media type that should be used to generate an example.
Currently only application/json
and application/xml
is supported.
Feel free to send a PR to add support for more media types.
The computeExamples()
method tries to lookup an example property in any AMF shape.
If possible (and no rawOnly
or noAuto
option is set) then it generates an example
depending on passed object.
git clone https://github.com/advanced-rest-client/api-example-generator
cd api-example-generator
npm install
npm start
npm test
This components is a part of API components ecosystem
FAQs
Examples generator from AMF model
The npm package @api-components/api-example-generator receives a total of 451 weekly downloads. As such, @api-components/api-example-generator popularity was classified as not popular.
We found that @api-components/api-example-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.