From c44c91778f3fe92ad4b89ac366ee8d0a251760ad Mon Sep 17 00:00:00 2001 From: Carolina Wright Date: Thu, 3 Aug 2023 16:48:24 -0300 Subject: [PATCH 1/4] feat(demo): new model --- demo/W-13770031/DataTypes/Kamino-library.raml | 20 +++++++++++++++++++ demo/W-13770031/ResourceTypes/Kamino1.raml | 7 +++++++ demo/W-13770031/W-13770031.raml | 11 ++++++++++ demo/apis.json | 1 + demo/index.js | 1 + 5 files changed, 40 insertions(+) create mode 100644 demo/W-13770031/DataTypes/Kamino-library.raml create mode 100644 demo/W-13770031/ResourceTypes/Kamino1.raml create mode 100644 demo/W-13770031/W-13770031.raml diff --git a/demo/W-13770031/DataTypes/Kamino-library.raml b/demo/W-13770031/DataTypes/Kamino-library.raml new file mode 100644 index 0000000..b5a89f8 --- /dev/null +++ b/demo/W-13770031/DataTypes/Kamino-library.raml @@ -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 \ No newline at end of file diff --git a/demo/W-13770031/ResourceTypes/Kamino1.raml b/demo/W-13770031/ResourceTypes/Kamino1.raml new file mode 100644 index 0000000..dc2d894 --- /dev/null +++ b/demo/W-13770031/ResourceTypes/Kamino1.raml @@ -0,0 +1,7 @@ +#%RAML 1.0 ResourceType + +post: + displayName: ANAUIUXS2_DEV-3915の調査 + body: + application/json: + type: kaminoLib.1-post diff --git a/demo/W-13770031/W-13770031.raml b/demo/W-13770031/W-13770031.raml new file mode 100644 index 0000000..177a128 --- /dev/null +++ b/demo/W-13770031/W-13770031.raml @@ -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 \ No newline at end of file diff --git a/demo/apis.json b/demo/apis.json index e4b6c20..238e8ae 100644 --- a/demo/apis.json +++ b/demo/apis.json @@ -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" }, diff --git a/demo/index.js b/demo/index.js index 0ae1c8a..ec869c5 100644 --- a/demo/index.js +++ b/demo/index.js @@ -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` ${label} - compact model Date: Thu, 3 Aug 2023 16:49:57 -0300 Subject: [PATCH 2/4] fix(ApiTypeDocument): new property to show/hide array info --- src/ApiTypeDocument.d.ts | 2 ++ src/ApiTypeDocument.js | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/ApiTypeDocument.d.ts b/src/ApiTypeDocument.d.ts index d27e183..054269b 100644 --- a/src/ApiTypeDocument.d.ts +++ b/src/ApiTypeDocument.d.ts @@ -174,6 +174,8 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) { */ noMediaSelector: boolean; + noArrayInfo: boolean; + get shouldRenderMediaSelector(): boolean; constructor(); diff --git a/src/ApiTypeDocument.js b/src/ApiTypeDocument.js index 22d75eb..3c02d05 100644 --- a/src/ApiTypeDocument.js +++ b/src/ApiTypeDocument.js @@ -167,6 +167,8 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) { * applicable. */ noMediaSelector: { type: Boolean }, + + noArrayInfo: { type: Boolean }, }; } @@ -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`` } /** From f7ade44a461013beca45ed51c09bdcbaf52f6069 Mon Sep 17 00:00:00 2001 From: Carolina Wright Date: Thu, 3 Aug 2023 16:50:29 -0300 Subject: [PATCH 3/4] fix(PropertyShapeDocument): pass new prop to ApiTypeDocument --- src/PropertyShapeDocument.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PropertyShapeDocument.js b/src/PropertyShapeDocument.js index 7ce043e..5bfba27 100644 --- a/src/PropertyShapeDocument.js +++ b/src/PropertyShapeDocument.js @@ -582,6 +582,7 @@ export class PropertyShapeDocument extends PropertyDocumentMixin(LitElement) { ?compatibility="${this.compatibility}" ?noExamplesActions="${this.noExamplesActions}" noMainExample + noArrayInfo .mediaType="${this.mediaType}" ?graph="${this.graph}" >`; From 8b53e331e942a95bae46ec2e6deab736e6794a16 Mon Sep 17 00:00:00 2001 From: Carolina Wright Date: Thu, 3 Aug 2023 16:50:44 -0300 Subject: [PATCH 4/4] 4.2.28 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 723fb14..65bbdee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@api-components/api-type-document", - "version": "4.2.27", + "version": "4.2.28", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 7330b2c..5c3195a 100644 --- a/package.json +++ b/package.json @@ -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",