mirror of
https://github.com/strapi/strapi.git
synced 2025-11-13 00:29:51 +00:00
Fix diff formatting for schemas matching
This commit is contained in:
parent
5f8422140e
commit
80c0153907
@ -346,7 +346,7 @@ class TransferEngine<
|
|||||||
keys.forEach((key) => {
|
keys.forEach((key) => {
|
||||||
const sourceSchema = sourceSchemas[key];
|
const sourceSchema = sourceSchemas[key];
|
||||||
const destinationSchema = destinationSchemas[key];
|
const destinationSchema = destinationSchemas[key];
|
||||||
const schemaDiffs = compareSchemas(sourceSchema, destinationSchema, strategy);
|
const schemaDiffs = compareSchemas(destinationSchema, sourceSchema, strategy);
|
||||||
|
|
||||||
if (schemaDiffs.length) {
|
if (schemaDiffs.length) {
|
||||||
diffs[key] = schemaDiffs;
|
diffs[key] = schemaDiffs;
|
||||||
@ -361,16 +361,18 @@ class TransferEngine<
|
|||||||
msg += ctDiffs
|
msg += ctDiffs
|
||||||
.sort((a, b) => (a.kind > b.kind ? -1 : 1))
|
.sort((a, b) => (a.kind > b.kind ? -1 : 1))
|
||||||
.map((diff) => {
|
.map((diff) => {
|
||||||
|
const path = diff.path.join('.');
|
||||||
|
|
||||||
if (diff.kind === 'added') {
|
if (diff.kind === 'added') {
|
||||||
return `Added "${diff.path}": "${diff.value}" (${diff.type})`;
|
return `Added "${path}": "${diff.value}" (${diff.type})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diff.kind === 'deleted') {
|
if (diff.kind === 'deleted') {
|
||||||
return `Removed "${diff.path}"`;
|
return `Removed "${path}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diff.kind === 'modified') {
|
if (diff.kind === 'modified') {
|
||||||
return `Modified "${diff.path}". "${diff.values[0]}" (${diff.types[0]}) => "${diff.values[1]}" (${diff.types[1]})`;
|
return `Modified "${path}": "${diff.values[0]}" (${diff.types[0]}) => "${diff.values[1]}" (${diff.types[1]})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new TransferEngineValidationError(`Invalid diff found for "${uid}"`, {
|
throw new TransferEngineValidationError(`Invalid diff found for "${uid}"`, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user