Skip to content

Commit

Permalink
Merge pull request #57 from advanced-rest-client/fix/W-15607551/fix-b…
Browse files Browse the repository at this point in the history
…indings

Fix/w 15607551/fix bindings
  • Loading branch information
leandrogilcarrano authored May 3, 2024
2 parents ea9950f + e052d0e commit d83fdbf
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@api-components/api-body-document",
"description": "A component to render HTTP method body documentation based on AMF model",
"version": "4.4.9",
"version": "4.4.10",
"license": "Apache-2.0",
"main": "index.js",
"module": "index.js",
Expand Down
25 changes: 23 additions & 2 deletions src/ApiBodyDocumentElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ export class ApiBodyDocumentElement extends AmfHelperMixin(LitElement) {

try {
this._bindings = value?.map((item) => ({
key: item[messageKey][0][descriptionKey][0]['@value'],
dataType: item[messageKey][0][dataTypeKey] ? this._getDataType(item[messageKey][0][dataTypeKey][0]['@id']) : 'any', // integer, number, long, float, double, boolean
key: item[messageKey] ? item[messageKey][0][descriptionKey][0]['@value']: false,
dataType: item[messageKey] && item[messageKey][0][dataTypeKey] ? this._getDataType(item[messageKey][0][dataTypeKey][0]['@id']) : 'any', // integer, number, long, float, double, boolean
bindingType: this._getValue(item, typeKey), // kafka, AMQP, etc
}))
} catch(e) {
Expand Down Expand Up @@ -617,6 +617,27 @@ export class ApiBodyDocumentElement extends AmfHelperMixin(LitElement) {
<div slot="markdown-html" class="markdown-html" part="markdown-html" ?data-with-title="${hasTypeName}"></div>
</arc-marked>` : ''}
${this._isAsyncAPI(this.amf) && !!this.bindings ?
html`<ul class="bindings-container-list">
${this.bindings.map(item => html`<li>
<p class="bindings-header">
<label>Message specific information:</label>
<span class="binding-type"> ${item.bindingType}</span>
</p>
${item.key!==false ?
html `
<div class="bindings-body">
<label>key</label>
<span class="binding-key">${item.key}</span>
<span class="binding-data-type">${item.dataType}</span>
</div>
`
: ''}
</li>`)}
</ul>`
: ''}
${_isObject ?
html`<api-type-document
.amf="${amf}"
Expand Down

0 comments on commit d83fdbf

Please sign in to comment.