Skip to content
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
24 changes: 11 additions & 13 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand All @@ -38,27 +37,26 @@ 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
with:
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
Expand Down
13 changes: 3 additions & 10 deletions src/ApiTypeDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion test/api-type-document.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,11 @@ describe('<api-type-document>', () => {
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
)
);
});
Expand Down
Loading