Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[W-13772034] Duplicated array info #77

Merged
merged 4 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions demo/W-13770031/DataTypes/Kamino-library.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#%RAML 1.0 Library
usage:
types:
1-post:
properties:
parent1:
description: 親要素にmaxItemsの指定あり
type: array
maxItems: 2

items:
properties:
child:
type: string
child2:
type: string[]
example:
- A
- B
- C
7 changes: 7 additions & 0 deletions demo/W-13770031/ResourceTypes/Kamino1.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#%RAML 1.0 ResourceType

post:
displayName: ANAUIUXS2_DEV-3915の調査
body:
application/json:
type: kaminoLib.1-post
11 changes: 11 additions & 0 deletions demo/W-13770031/W-13770031.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#%RAML 1.0
title: avnz_work

resourceTypes:
kamino1: !include /ResourceTypes/Kamino1.raml

uses:
kaminoLib: /DataTypes/Kamino-library.raml

/kamino/1:
type: kamino1
1 change: 1 addition & 0 deletions demo/apis.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"W-11858334/W-11858334.raml": "RAML 1.0",
"W-12137562/W-12137562.raml": "RAML 1.0",
"W-12428173/W-12428173.raml": "RAML 1.0",
"W-13770031/W-13770031.raml": "RAML 1.0",
"APIC-429/APIC-429.yaml": { "type": "OAS 3.0", "mime": "application/yaml" },
"SE-17897/SE-17897.yaml": { "type": "OAS 3.0", "mime": "application/yaml" },
"W-13547158/W-13547158.yaml": { "type": "OAS 3.0", "mime": "application/yaml" },
Expand Down
1 change: 1 addition & 0 deletions demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class ApiDemo extends ApiDemoPage {
['W-12137562', 'W-12137562'],
['W-12428173', 'W-12428173'],
['W-13547158', 'W-13547158'],
['W-13770031', 'W-13770031'],
].map(
([file, label]) => html` <anypoint-item data-src="${file}-compact.json"
>${label} - compact model</anypoint-item
Expand Down
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-type-document",
"description": "A documentation table for type (resource) properties. Works with AMF data model",
"version": "4.2.27",
"version": "4.2.28",
"license": "Apache-2.0",
"main": "index.js",
"module": "index.js",
Expand Down
2 changes: 2 additions & 0 deletions src/ApiTypeDocument.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
*/
noMediaSelector: boolean;

noArrayInfo: boolean;

get shouldRenderMediaSelector(): boolean;

constructor();
Expand Down
17 changes: 11 additions & 6 deletions src/ApiTypeDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
* applicable.
*/
noMediaSelector: { type: Boolean },

noArrayInfo: { type: Boolean },
};
}

Expand Down Expand Up @@ -685,13 +687,16 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
}

_arrayPropertiesTemplate() {
const minCount = this._getValue(this._resolvedType, this.ns.w3.shacl.minCount)
const maxCount = this._getValue(this._resolvedType, this.ns.w3.shacl.maxCount)
if (!this.noArrayInfo) {
const minCount = this._getValue(this._resolvedType, this.ns.w3.shacl.minCount)
const maxCount = this._getValue(this._resolvedType, this.ns.w3.shacl.maxCount)

return html`
${minCount !== undefined ? this._arrayPropertyTemplate('Minimum array length:', minCount, 'Minimum amount of items in array') : ''}
${maxCount !== undefined ? this._arrayPropertyTemplate('Maximum array length:', maxCount, 'Maximum amount of items in array') : ''}
`
return html`
${minCount !== undefined ? this._arrayPropertyTemplate('Minimum array length:', minCount, 'Minimum amount of items in array') : ''}
${maxCount !== undefined ? this._arrayPropertyTemplate('Maximum array length:', maxCount, 'Maximum amount of items in array') : ''}
`
}
return html``
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/PropertyShapeDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ export class PropertyShapeDocument extends PropertyDocumentMixin(LitElement) {
?compatibility="${this.compatibility}"
?noExamplesActions="${this.noExamplesActions}"
noMainExample
noArrayInfo
.mediaType="${this.mediaType}"
?graph="${this.graph}"
></api-type-document>`;
Expand Down
Loading