From 826976c1306c14bcb84a97cda2281812c8a9f3b5 Mon Sep 17 00:00:00 2001 From: Alex Perez Date: Fri, 28 Nov 2025 01:36:52 -0300 Subject: [PATCH 1/2] fix: preserve "array of" indicator in UI for ArrayShape handling --- src/ApiTypeDocument.js | 13 +++---------- test/api-type-document.test.js | 3 ++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/ApiTypeDocument.js b/src/ApiTypeDocument.js index 6189ced..869dea8 100644 --- a/src/ApiTypeDocument.js +++ b/src/ApiTypeDocument.js @@ -526,18 +526,11 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) { if (Array.isArray(item)) { [item] = item; } + // For array types in unions, return the array itself instead of unwrapping to items + // This preserves the "array of" indicator in the UI if (this._hasType(item, this.ns.aml.vocabularies.shapes.ArrayShape)) { item = this._resolve(item); - const itemsKey = this._getAmfKey(this.ns.aml.vocabularies.shapes.items); - const items = this._ensureArray(item[itemsKey]); - if (items && items.length === 1) { - let result = items[0]; - if (Array.isArray(result)) { - [result] = result; - } - result = this._resolve(result); - return result; - } + return item; } if (Array.isArray(item)) { [item] = item; diff --git a/test/api-type-document.test.js b/test/api-type-document.test.js index 3a46da8..b5282bf 100644 --- a/test/api-type-document.test.js +++ b/test/api-type-document.test.js @@ -349,10 +349,11 @@ describe('', () => { element.amf = amf; key = element._getAmfKey(element.ns.aml.vocabularies.shapes.anyOf); const result = element._computeProperty(type, key, 0); + // Should return ArrayShape to preserve "Array of" indicator in UI assert.isTrue( element._hasType( result, - element.ns.aml.vocabularies.shapes.ScalarShape + element.ns.aml.vocabularies.shapes.ArrayShape ) ); }); From c49f58d81e58552152b7244ed775391b44298f6e Mon Sep 17 00:00:00 2001 From: Alex Perez Date: Fri, 28 Nov 2025 01:43:38 -0300 Subject: [PATCH 2/2] chore: update GitHub Actions workflow for testing and deployment - Renamed test job from 'test_linux' to 'tests' for clarity. - Updated OS matrix to include Ubuntu 22.04 and Windows 2022. - Changed Node.js version from 16 to 18 in both test and publish jobs. - Upgraded actions/cache from v1 to v3 for improved caching. - Modified publish job to run on 'mulesoft-ubuntu' and adjusted conditions for execution. --- .github/workflows/deployment.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index bbcb874..1dcc5f2 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -12,21 +12,20 @@ on: - master - main jobs: - test_linux: + tests: name: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-20.04] - # os: [ubuntu-18.04, ubuntu-20.04] + os: [ubuntu-22.04, windows-2022] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: 16 + node-version: 18 - uses: microsoft/playwright-github-action@v1 - - uses: actions/cache@v1 + - uses: actions/cache@v3 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} @@ -38,11 +37,10 @@ jobs: run: npm test tag: name: "Publishing release" - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' - needs: - - test_linux - # - test_win - runs-on: ubuntu-latest + if: github.event_name != 'pull_request' + needs: + - tests + runs-on: mulesoft-ubuntu steps: - name: Checkout code uses: actions/checkout@v2 @@ -50,15 +48,15 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v2 with: - node-version: '16.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - - uses: actions/cache@v1 + - uses: actions/cache@v3 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm install + - run: npm ci - name: Read version from package.json uses: culshaw/read-package-node-version-actions@v1 id: package-node-version