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 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 ) ); });