Skip to content

Commit 06ea727

Browse files
author
alexperez
committed
fix: update raw value checks in ExampleGenerator to handle null and undefined cases
1 parent eb69360 commit 06ea727

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ExampleGenerator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ export class ExampleGenerator extends AmfHelperMixin(Object) {
641641
example,
642642
this.ns.aml.vocabularies.document.raw
643643
));
644-
if (!raw) {
644+
if (raw === null || raw === undefined) {
645645
raw = /** @type {string} */ (this._getValue(
646646
example,
647647
this.ns.w3.shacl.raw
@@ -707,7 +707,7 @@ export class ExampleGenerator extends AmfHelperMixin(Object) {
707707
example,
708708
this.ns.aml.vocabularies.core.description
709709
));
710-
const hasRaw = !!raw;
710+
const hasRaw = raw !== null && raw !== undefined;
711711
const result = {};
712712
result.hasTitle = !!title;
713713
result.hasUnion = false;
@@ -717,7 +717,7 @@ export class ExampleGenerator extends AmfHelperMixin(Object) {
717717
if (result.hasTitle) {
718718
result.title = title;
719719
}
720-
if (opts.rawOnly && !raw) {
720+
if (opts.rawOnly && (raw !== null || raw !== undefined)) {
721721
return undefined;
722722
}
723723
if (opts.rawOnly) {

0 commit comments

Comments
 (0)