Skip to content

Commit 4708fe7

Browse files
refactor: align flag using ignoreValidation everywhere
1 parent 54e887a commit 4708fe7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/core/src/interaction-output.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class InteractionOutput implements WoT.InteractionOutput {
4242
dataUsed: boolean;
4343
form?: WoT.Form;
4444
schema?: WoT.DataSchema;
45-
enforceValidation: boolean; // by default set to true
45+
ignoreValidation: boolean; // by default set to false
4646

4747
public get data(): ReadableStream {
4848
if (this.#stream) {
@@ -62,7 +62,7 @@ export class InteractionOutput implements WoT.InteractionOutput {
6262
this.#content = content;
6363
this.form = form;
6464
this.schema = schema;
65-
this.enforceValidation = ignoreValidation === undefined ? true : !ignoreValidation;
65+
this.ignoreValidation = ignoreValidation ?? false;
6666
this.dataUsed = false;
6767
}
6868

@@ -124,7 +124,7 @@ export class InteractionOutput implements WoT.InteractionOutput {
124124
// validate the schema
125125
const validate = ajv.compile<T>(this.schema);
126126

127-
if (this.enforceValidation && !validate(json)) {
127+
if (!this.ignoreValidation && !validate(json)) {
128128
debug(`schema = ${util.inspect(this.schema, { depth: 10, colors: true })}`);
129129
debug(`value: ${json}`);
130130
debug(`Errror: ${validate.errors}`);

0 commit comments

Comments
 (0)