api-example-generator

WebJar for api-example-generator

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

org.webjars.bowergithub.advanced-rest-client
Идентификатор

Идентификатор

api-example-generator
Последняя версия

Последняя версия

2.0.8
Дата

Дата

Тип

Тип

jar
Описание

Описание

api-example-generator
WebJar for api-example-generator
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/advanced-rest-client/api-example-generator

Скачать api-example-generator

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/api-example-generator/ -->
<dependency>
    <groupId>org.webjars.bowergithub.advanced-rest-client</groupId>
    <artifactId>api-example-generator</artifactId>
    <version>2.0.8</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/api-example-generator/
implementation 'org.webjars.bowergithub.advanced-rest-client:api-example-generator:2.0.8'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/api-example-generator/
implementation ("org.webjars.bowergithub.advanced-rest-client:api-example-generator:2.0.8")
'org.webjars.bowergithub.advanced-rest-client:api-example-generator:jar:2.0.8'
<dependency org="org.webjars.bowergithub.advanced-rest-client" name="api-example-generator" rev="2.0.8">
  <artifact name="api-example-generator" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.advanced-rest-client', module='api-example-generator', version='2.0.8')
)
libraryDependencies += "org.webjars.bowergithub.advanced-rest-client" % "api-example-generator" % "2.0.8"
[org.webjars.bowergithub.advanced-rest-client/api-example-generator "2.0.8"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.webjars.bowergithub.polymer : polymer jar [2.0.0,3)
org.webjars.bowergithub.advanced-rest-client : amf-helper-mixin jar [2.0.0,3)

Модули Проекта

Данный проект не имеет модулей.

Published on NPM

Build Status

ExampleGenerator

Generates examples from the 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.

Breaking

The api-example-generator custom element is deprecated and will be removed with the next major release. The element was creates when the AmfHelperMixin needed a HTMLElement constructor. Now there is no such requirement and the not this works as a JS library.

Usage

Installation

npm install --save @api-components/api-example-generator

API

See src/ExampleGenerator for the public API.

import { ExampleGenerator } '@api-components/api-example-generator';
const gen = new ExampleGenerator(amfModel);

const examples = new gen.computeExamples(schema, 'application/json', {...});

In an html file

This is deprecated

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

In a LitElement element

This is deprecated

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);

Listing media types for payloads

Use listMedia() which accespts list of payloads or a single payload definition.

Example for Payload(s)

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.

Example from any AMF shape

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.

Development

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

Running the demo locally

npm start

Running the tests

npm test
org.webjars.bowergithub.advanced-rest-client

ARC

A set of repositories related to the Advanced REST Client and API console (by Mulesoft)

Версии библиотеки

Версия
2.0.8