@api-components/api-method-documentation

A HTTP method documentation build from AMF model

Usage no npm install needed!

<script type="module">
  import apiComponentsApiMethodDocumentation from 'https://cdn.skypack.dev/@api-components/api-method-documentation';
</script>

README

DEPRECATED

This component is being deprecated. The code base has been moved to api-documentation module. This module will be archived when PR 37 is merged.


A HTTP method documentation generated from an AMF model.

Published on NPM

Tests and publishing

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-method-documentation

In an html file

<html>
  <head>
    <script type="module">
      import '@api-components/api-method-documentation/api-method-documentation.js';
    </script>
  </head>
  <body>
    <api-method-documentation amf="..." endpoint="..." method="..."></api-method-documentation>
  </body>
</html>

In a LitElement

import { LitElement, html } from 'lit-element';
import '@api-components/api-method-documentation/api-method-documentation.js';

class SampleElement extends PolymerElement {
  render() {
    return html`
    <api-method-documentation
      .amf="${this.amf}"
      .server="${server}"
      .endpoint="${this.endpoint}"
      .method="${this.method}"
      .previous="${this.previous}"
      .next="${this.next}"
      ?renderCodeSnippets="${this.codeSnippets}"
      ?narrow="${this.narrow}"
      .renderSecurity="${this.renderSecurity}"
      .noTryIt="${this.noTryit}"
      ?legacy="${this.legacy}"
      @tryit-requested="${this._tryitHandler}"></api-method-documentation>
    `;
  }

  _tryitHandler(e) {
    console.log('opening api-request-panel...');
  }
}
customElements.define('sample-element', SampleElement);

Development

git clone https://github.com/api-components/api-method-documentation
cd api-method-documentation
npm install

Running the demo locally

npm start

Running the tests

npm test