Socket
Socket
Sign inDemoInstall

@sfdocs-internal/api-endpoint-documentation

Package Overview
Dependencies
Maintainers
17
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sfdocs-internal/api-endpoint-documentation

A component to generate documentation for a resource from AMF model


Version published
Weekly downloads
0
Maintainers
17
Weekly downloads
 
Created
Source

DEPRECATED

This component is being deprecated. The code base has been moved to amf-components module. This module will be archived when PR 1 is merged.


A component to generate documentation for an API resource from AMF model.

Tests and publishing

Published on NPM

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.

Styling

<api-endpoint-documentation> provides the following custom properties and mixins for styling:

Custom propertyDescriptionDefault
--arc-font-headline-colorColor of the method title``
--arc-font-headline-font-sizeFont size of the method title``
--arc-font-headline-letter-spacingLetter spacing of the method title``
--arc-font-headline-line-heightLine height of the method title``
--arc-font-headline-narrow-font-sizeFont size of the method title in mobile-friendly view``
--arc-font-title-colorColor of the overview section title``
--arc-font-title-font-sizeFont size of the overview section title``
--arc-font-title-line-heightLine height of the overview section title``
--arc-font-title-narrow-font-sizeFont size of the overview section title in mobile-friendly view``
--arc-font-subhead-colorColor of the collapsible section title``
--arc-font-subhead-font-sizeFont size of the collapsible section title``
--arc-font-subhead-line-heightLine height of the collapsible section title``
--arc-font-subhead-narrow-font-sizeFont size of the collapsible section title in mobile-friendly view``
--api-endpoint-documentation-description-colorrgba(0, 0, 0, 0.74)
--api-endpoint-documentation-bottom-navigation-color#000
--api-endpoint-documentation-method-doc-border-top-color#E5E5E5
--api-endpoint-documentation-method-doc-border-top-styledashed
--api-endpoint-documentation-tryit-width40%
--api-endpoint-documentation-tryit-max-width``
--api-endpoint-documentation-tryit-background-color#ECEFF1
--api-endpoint-documentation-tryit-panels-background-color#fff
--api-endpoint-documentation-tryit-panels-border-radius3px
--api-endpoint-documentation-tryit-panels-border-color#EEEEEE
--api-endpoint-documentation-tryit-panels-border-stylesolid
--api-endpoint-documentation-tryit-title-border-bottom-color#bac6cb
--api-endpoint-documentation-tryit-title-border-bottom-stylesolid
--no-info-message-font-styleitalic
--no-info-message-font-size16px
--no-info-message-colorrgba(0, 0, 0, 0.74)

Usage

Installation

npm install --save @api-components/api-endpoint-documentation

In an html file

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

In a LitElement

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

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

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

Development

git clone https://github.com/advanced-rest-client/api-endpoint-documentation
cd api-endpoint-documentation
npm install

Running the demo locally

npm start

Running the tests

npm test

Breaking Changes in v3

When using inlineMethods property you should note this breaking changes.

OAuth popup location

The bower-location attribute becomes auth-popup-location. It is a path to node_modules directory. It can be both relative or absolute location. For example /static/console/node_modules will produce OAuth Redirect URI /static/console/node_modules/@advanced-rest-client/oauth-authorization/oauth-popup.html.

However, you are encourage to use your own redirect popup. It can be anything but it must post message to the opened window with URL parameters. See @advanced-rest-client/oauth-authorization/oauth-popup.html for more details.

Code Mirror dependencies

Code mirror is not ES6 ready. Their build contains AMD exports which is incompatible with native modules. Therefore the dependencies cannot be imported with the element but outside of it. The component requires the following scripts to be ready before it's initialized (especially body and headers editors):

<script src="node_modules/jsonlint/lib/jsonlint.js"></script>
<script src="node_modules/codemirror/lib/codemirror.js"></script>
<script src="node_modules/codemirror/addon/mode/loadmode.js"></script>
<script src="node_modules/codemirror/mode/meta.js"></script>
<!-- Some basic syntax highlighting -->
<script src="node_modules/codemirror/mode/javascript/javascript.js"></script>
<script src="node_modules/codemirror/mode/xml/xml.js"></script>
<script src="node_modules/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<script src="node_modules/codemirror/addon/lint/lint.js"></script>
<script src="node_modules/codemirror/addon/lint/json-lint.js"></script>

CodeMirror's modes location. May be skipped if all possible modes are already included into the app.

<script>
/* global CodeMirror */
CodeMirror.modeURL = 'node_modules/codemirror/mode/%N/%N.js';
</script>

Dependencies for OAuth1 and Digest authorization methods

For the same reasons as for CodeMirror this dependencies are required for OAuth1 and Digest authorization panels to work.

<script src="node_modules/cryptojslib/components/core.js"></script>
<script src="node_modules/cryptojslib/rollups/sha1.js"></script>
<script src="node_modules/cryptojslib/components/enc-base64-min.js"></script>
<script src="node_modules/cryptojslib/rollups/md5.js"></script>
<script src="node_modules/cryptojslib/rollups/hmac-sha1.js"></script>
<script src="node_modules/jsrsasign/lib/jsrsasign-rsa-min.js"></script>

Keywords

FAQs

Package last updated on 29 Dec 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc