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
25 changes: 13 additions & 12 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,26 @@ on:
- main
jobs:
test_linux:
name: Ubuntu
runs-on: ubuntu-latest
name: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- uses: actions/cache@v1
- uses: microsoft/playwright-github-action@v1
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Playwright dependencies
run: npx playwright install --with-deps
- name: Install dependencies
run: npm ci
run: npm install
- name: Run tests
run: npm test
test_win:
Expand All @@ -41,16 +44,14 @@ jobs:
with:
node-version: 16
- 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') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Playwright dependencies
run: npx playwright install --with-deps
- name: Install dependencies
run: npm ci
run: npm install
- name: Run tests
run: npm test
tag:
Expand All @@ -69,7 +70,7 @@ jobs:
with:
node-version: '16.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') }}
Expand All @@ -96,4 +97,4 @@ jobs:
prerelease: false
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@api-components/api-example-generator",
"description": "Examples generator from AMF model",
"version": "4.4.31",
"version": "4.4.32",
"license": "Apache-2.0",
"main": "index.js",
"module": "index.js",
Expand Down Expand Up @@ -90,5 +90,8 @@
"*.js": [
"eslint --fix"
]
},
"overrides": {
"playwright": "1.25.2"
}
}
8 changes: 5 additions & 3 deletions src/ExampleGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,9 @@ export class ExampleGenerator extends AmfHelperMixin(Object) {
example,
this.ns.aml.vocabularies.document.raw
));
if (!raw) {
const rawIsNull = raw === null;
const rawIsUndefined = raw === undefined;
if (rawIsNull || rawIsUndefined) {
raw = /** @type {string} */ (this._getValue(
example,
this.ns.w3.shacl.raw
Expand Down Expand Up @@ -707,7 +709,7 @@ export class ExampleGenerator extends AmfHelperMixin(Object) {
example,
this.ns.aml.vocabularies.core.description
));
const hasRaw = !!raw;
const hasRaw = !rawIsNull && !rawIsUndefined;
const result = {};
result.hasTitle = !!title;
result.hasUnion = false;
Expand All @@ -717,7 +719,7 @@ export class ExampleGenerator extends AmfHelperMixin(Object) {
if (result.hasTitle) {
result.title = title;
}
if (opts.rawOnly && !raw) {
if (opts.rawOnly && (rawIsNull || rawIsUndefined)) {
return undefined;
}
if (opts.rawOnly) {
Expand Down
Loading