4.2.5 • Published 3 years ago
@api-components/api-responses-document v4.2.5
api-responses-document
A documentation for HTTP method responses based on AMF model.
Version compatibility
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.
Usage
Installation
npm install --save @api-components/api-responses-document
In an html file
<html>
<head>
<script type="module">
import '@api-components/api-responses-document/api-responses-document.js';
</script>
</head>
<body>
<api-responses-document></api-responses-document>
<script>
const model = await getAmfModel();
const returns = await getMethodReturns(model);
const doc = document.querySelector('api-responses-document');
doc.amf = model;
doc.returns = returns;
// Select a 400 response from auto generated list of available status codes
const index = doc.codes.indexOf(400);
doc.selected = index;
</script>
</body>
</html>
In a LitElement
import { LitElement, html } from 'lit-element';
import '@api-components/api-responses-document/api-responses-document.js';
class SampleElement extends PolymerElement {
render() {
return html`
<api-responses-document .amf="${this.amf}" returns="..."></api-responses-document>
`;
}
}
customElements.define('sample-element', SampleElement);
In a Polymer 3 element
import {PolymerElement, html} from '@polymer/polymer';
import '@api-components/api-responses-document/api-responses-document.js';
class SampleElement extends PolymerElement {
static get template() {
return html`
<api-responses-document></api-responses-document>
`;
}
}
customElements.define('sample-element', SampleElement);
Development
git clone https://github.com/api-components/api-responses-document
cd api-responses-document
npm install
Running the demo locally
npm start
Running the tests
npm test
4.2.5
3 years ago
4.2.4
3 years ago
4.2.3
3 years ago
4.2.2
3 years ago
4.2.1
3 years ago
4.2.0
3 years ago
4.1.3
4 years ago
4.1.2
4 years ago
4.1.1
4 years ago
4.1.0
4 years ago
4.0.2
4 years ago
4.0.1
5 years ago
4.0.0
5 years ago
3.0.4
5 years ago
3.0.3
5 years ago
3.0.2
5 years ago
3.0.1
5 years ago
3.0.0
5 years ago
3.0.0-preview.2
5 years ago
3.0.0-preview.1
5 years ago
2.0.4
6 years ago
2.0.3
6 years ago
2.0.2
6 years ago
2.0.0
6 years ago