Skip to content

Commit

Permalink
Rename "warn" to "warnings"
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrina-p committed Jul 24, 2024
1 parent 8542006 commit 3fff064
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/modify.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function rewriteAllFields(schema, configCallback, context) {

export function modify(originalSchema, config) {
const schema = JSON.parse(JSON.stringify(originalSchema));
let warn = []; // To be implemented in next PRs.
let warnings = []; // To be implemented in next PRs.

// All these functions mutate "schema",
// that's why we create a copy above
Expand All @@ -90,12 +90,12 @@ export function modify(originalSchema, config) {

if (!config.muteWarningTip) {
console.warn(
'json-schema-form modify(): Make sure you log the returned `warn` as they highlight possible bugs in your modifications. To mute this log, pass `muteWarningTip: true` to the config.'
'json-schema-form modify(): We highly recommend you to handle/report the returned `warnings` as they highlight possible bugs in your modifications. To mute this log, pass `muteWarningTip: true` to the config.'
);
}

return {
schema,
warn: warn.length > 0 ? warn : undefined,
warnings: warnings.length > 0 ? warnings : null,
};
}
6 changes: 3 additions & 3 deletions src/tests/modify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ describe('modify() - warnings', () => {
const result = modify(schemaPet, {});

expect(console.warn).toBeCalledWith(
'json-schema-form modify(): Make sure you log the returned `warn` as they highlight possible bugs in your modifications. To mute this log, pass `muteWarningTip: true` to the config.'
'json-schema-form modify(): We highly recommend you to handle/report the returned `warnings` as they highlight possible bugs in your modifications. To mute this log, pass `muteWarningTip: true` to the config.'
);

console.warn.mockClear();
expect(result.warn).toBeUndefined();
expect(result.warnings).toBeNull();
});

it('given muteWarningTip, it does not log the warning', () => {
Expand All @@ -128,7 +128,7 @@ describe('modify() - warnings', () => {
});

expect(console.warn).not.toBeCalled();
expect(result.warn).toBeUndefined();
expect(result.warnings).toBeNull();
});
});

Expand Down

0 comments on commit 3fff064

Please sign in to comment.