api-view-model-transformer

WebJar for api-view-model-transformer

Лицензия

Лицензия

Категории

Категории

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

Группа

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

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

api-view-model-transformer
Последняя версия

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

2.0.18
Дата

Дата

Тип

Тип

jar
Описание

Описание

api-view-model-transformer
WebJar for api-view-model-transformer
Ссылка на сайт

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

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

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

https://github.com/advanced-rest-client/api-view-model-transformer

Скачать api-view-model-transformer

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

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

Зависимости

compile (4)

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

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

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

Published on NPM

Build Status

Published on webcomponents.org

ApiViewModel

A library to transform AMF's ld-json model into a form view model. The form view is used to power editors embedded in the api-request-editor element. The model should be used to build a form view for request parameters like header, query parameters, uri parameters or the body.

Deprecation notice

This element is moved to api-forms repository and @api-components/api-forms package. This element will be deprecated and archived once the migration finish.

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.

Deprecation notice

The api-view-model-transformer custom element was build when the AmfHelperMixin was requiring a HTMLElement as a base class. Since it is not the case any more this element is being transformed into a JS library. The custom element has only previously accessible public properties. With the next major release the custom element will be removed. Please, use ApiViewModel class instead of element.

Usage

Installation

npm install --save @api-components/api-view-model-transformer

Example

import { ApiViewModel } from '@api-components/api-view-model-transformer';
const amf = getAmfFromRamlOrOas();
const headers = extractHeadersForMethod(amf); // or other types.
const worker = new ApiViewModel();
const viewModel = worker.computeViewModel(headers);

This example uses getAmfFromRamlOrOas() function where you implement the logic of getting AMF json/ld data. It can be stored in file or parsed using AMF parsers. The extractHeadersForMethod() represents a logic to extract properties that you want to transform. It can be headers, query parameters or body type.

Deprecated example

<api-view-model-transformer></api-view-model-transformer>
<script>
const amfModel = getAmfFromRamlOrOas();
const processor = document.querySelector('api-view-model-transformer');
processor.amf = amfModel;
processor.shape = extractHeadersForMethod(amfModel);
processor.addEventListener('view-model-changed', (e) => {
 console.log(e.detail.value);
});
</script>

ld+json context

JSON schema may contain @context property. It can be used to reduce size of the schema by replacing namespace ids with defined in @context keyword. For the component to properly compute AMF values the full AMF model has to be set on amf property.

Development

git clone https://github.com/advanced-rest-client/api-view-model-transformer
cd api-view-model-transformer
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.18