Skip to content

Commit 3d43ae8

Browse files
authored
Merge pull request #70 from advanced-rest-client/fix/W-17909207/when-example-is-empty-method-documentation-remains-blank
Fix/W-17909207/when-example-is-empty-method-documentation-remains-blank
2 parents eb69360 + 6044323 commit 3d43ae8

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

.github/workflows/deployment.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,26 @@ on:
1313
- main
1414
jobs:
1515
test_linux:
16-
name: Ubuntu
17-
runs-on: ubuntu-latest
16+
name: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-20.04]
21+
runs-on: ${{ matrix.os }}
1822
steps:
1923
- uses: actions/checkout@v2
2024
- uses: actions/setup-node@v1
2125
with:
2226
node-version: 16
23-
- uses: actions/cache@v1
27+
- uses: microsoft/playwright-github-action@v1
28+
- uses: actions/cache@v3
2429
with:
2530
path: ~/.npm
2631
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
2732
restore-keys: |
2833
${{ runner.os }}-node-
29-
- name: Install Playwright dependencies
30-
run: npx playwright install --with-deps
3134
- name: Install dependencies
32-
run: npm ci
35+
run: npm install
3336
- name: Run tests
3437
run: npm test
3538
test_win:
@@ -41,16 +44,14 @@ jobs:
4144
with:
4245
node-version: 16
4346
- uses: microsoft/playwright-github-action@v1
44-
- uses: actions/cache@v1
47+
- uses: actions/cache@v3
4548
with:
4649
path: ~/.npm
4750
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
4851
restore-keys: |
4952
${{ runner.os }}-node-
50-
- name: Install Playwright dependencies
51-
run: npx playwright install --with-deps
5253
- name: Install dependencies
53-
run: npm ci
54+
run: npm install
5455
- name: Run tests
5556
run: npm test
5657
tag:
@@ -69,7 +70,7 @@ jobs:
6970
with:
7071
node-version: '16.x'
7172
registry-url: 'https://registry.npmjs.org'
72-
- uses: actions/cache@v1
73+
- uses: actions/cache@v3
7374
with:
7475
path: ~/.npm
7576
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -96,4 +97,4 @@ jobs:
9697
prerelease: false
9798
- run: npm publish --access public
9899
env:
99-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
100+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@api-components/api-example-generator",
33
"description": "Examples generator from AMF model",
4-
"version": "4.4.31",
4+
"version": "4.4.32",
55
"license": "Apache-2.0",
66
"main": "index.js",
77
"module": "index.js",
@@ -90,5 +90,8 @@
9090
"*.js": [
9191
"eslint --fix"
9292
]
93+
},
94+
"overrides": {
95+
"playwright": "1.25.2"
9396
}
9497
}

src/ExampleGenerator.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,9 @@ export class ExampleGenerator extends AmfHelperMixin(Object) {
641641
example,
642642
this.ns.aml.vocabularies.document.raw
643643
));
644-
if (!raw) {
644+
const rawIsNull = raw === null;
645+
const rawIsUndefined = raw === undefined;
646+
if (rawIsNull || rawIsUndefined) {
645647
raw = /** @type {string} */ (this._getValue(
646648
example,
647649
this.ns.w3.shacl.raw
@@ -707,7 +709,7 @@ export class ExampleGenerator extends AmfHelperMixin(Object) {
707709
example,
708710
this.ns.aml.vocabularies.core.description
709711
));
710-
const hasRaw = !!raw;
712+
const hasRaw = !rawIsNull && !rawIsUndefined;
711713
const result = {};
712714
result.hasTitle = !!title;
713715
result.hasUnion = false;
@@ -717,7 +719,7 @@ export class ExampleGenerator extends AmfHelperMixin(Object) {
717719
if (result.hasTitle) {
718720
result.title = title;
719721
}
720-
if (opts.rawOnly && !raw) {
722+
if (opts.rawOnly && (rawIsNull || rawIsUndefined)) {
721723
return undefined;
722724
}
723725
if (opts.rawOnly) {

0 commit comments

Comments
 (0)