diff --git a/packages/dialog/src/library/schemaMerger.ts b/packages/dialog/src/library/schemaMerger.ts index 6cd7418c2..0934ea1c2 100644 --- a/packages/dialog/src/library/schemaMerger.ts +++ b/packages/dialog/src/library/schemaMerger.ts @@ -1424,6 +1424,7 @@ export class SchemaMerger { for (const [ext, files] of this.files.entries()) { for (const [file, records] of files.entries()) { const winner = records[0] + let winnerSrc = '' const same: PathComponent[] = [] const conflicts: PathComponent[] = [] for (const alt of records) { @@ -1431,18 +1432,24 @@ export class SchemaMerger { alt.node.metadata.includesSchema = true } if (alt !== winner) { - if (winner.node === alt.node) { - same.push(alt) - } else if (ext === '.schema') { - // Check for same content which can happen when project and nuget from project are - // both being used. - const winnerSrc = await fs.readFile(winner.path, 'utf8') - const altSrc = await fs.readFile(alt.path, 'utf8') - if (winnerSrc !== altSrc) { + if (!winnerSrc) { + winnerSrc = await fs.readFile(winner.path, 'utf8') + } + const altSrc = await fs.readFile(alt.path, 'utf8') + // If content is identical, then don't treat as a duplicate. + // This is mainly about nuget packages which like to have multiple copies of files. + if (winnerSrc !== altSrc) { + if (winner.node === alt.node) { + same.push(alt) + } else if (ext === '.schema') { + const winnerSrc = await fs.readFile(winner.path, 'utf8') + const altSrc = await fs.readFile(alt.path, 'utf8') + if (winnerSrc !== altSrc) { + conflicts.push(alt) + } + } else if (ext !== '.uischema') { conflicts.push(alt) } - } else if (ext !== '.uischema') { - conflicts.push(alt) } } } diff --git a/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/Microsoft.AdaptiveDialog.schema b/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/Microsoft.AdaptiveDialog.schema new file mode 100644 index 000000000..95fb1d9a2 --- /dev/null +++ b/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/Microsoft.AdaptiveDialog.schema @@ -0,0 +1,65 @@ +{ + "$schema": "https://schemas.botframework.com/schemas/component/v1.0/component.schema", + "$role": "implements(Microsoft.IDialog)", + "title": "Adaptive Dialog", + "description": "Flexible, data driven dialog that can adapt to the conversation.", + "type": "object", + "properties": { + "id": { + "type": "string", + "title": "Id", + "description": "Optional dialog ID." + }, + "autoEndDialog": { + "$ref": "schema:#/definitions/booleanExpression", + "title": "Auto end dialog", + "description": "If set to true the dialog will automatically end when there are no further actions. If set to false, remember to manually end the dialog using EndDialog action.", + "default": true + }, + "defaultResultProperty": { + "type": "string", + "title": "Default result property", + "description": "Value that will be passed back to the parent dialog.", + "default": "dialog.result" + }, + "recognizer": { + "$kind": "Microsoft.IRecognizer", + "title": "Recognizer", + "description": "Input recognizer that interprets user input into intent and entities." + }, + "generator": { + "$kind": "Microsoft.ILanguageGenerator", + "title": "Language Generator", + "description": "Language generator that generates bot responses." + }, + "selector": { + "$kind": "Microsoft.ITriggerSelector", + "title": "Selector", + "description": "Policy to determine which trigger is executed. Defaults to a 'best match' selector (optional)." + }, + "triggers": { + "type": "array", + "description": "List of triggers defined for this dialog.", + "title": "Triggers", + "items": { + "$kind": "Microsoft.ITrigger", + "title": "Event triggers", + "description": "Event triggers for handling events." + } + }, + "schema": { + "title": "Schema", + "description": "Schema to fill in.", + "anyOf": [ + { + "$ref": "http://json-schema.org/draft-07/schema#" + }, + { + "type": "string", + "title": "Reference to JSON schema", + "description": "Reference to JSON schema .dialog file." + } + ] + } + } +} diff --git a/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/Microsoft.AdaptiveDialog.uischema b/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/Microsoft.AdaptiveDialog.uischema new file mode 100644 index 000000000..37553d142 --- /dev/null +++ b/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/Microsoft.AdaptiveDialog.uischema @@ -0,0 +1,24 @@ +{ + "$schema": "https://schemas.botframework.com/schemas/ui/v1.0/ui.schema", + "form": { + "label": "Adaptive dialog", + "description": "This configures a data driven dialog via a collection of events and actions.", + "helpLink": "https://aka.ms/bf-composer-docs-dialog", + "order": [ + "recognizer", + "*" + ], + "hidden": [ + "triggers", + "generator", + "selector", + "schema" + ], + "properties": { + "recognizer": { + "label": "Language Understanding", + "description": "To understand what the user says, your dialog needs a \"Recognizer\"; that includes example words and sentences that users may use." + } + } + } +} diff --git a/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/nuget3.jpg b/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/nuget3.jpg new file mode 100644 index 000000000..ebc43fd72 --- /dev/null +++ b/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/nuget3.jpg @@ -0,0 +1 @@ +picture \ No newline at end of file diff --git a/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/nuget3.lg b/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/nuget3.lg new file mode 100644 index 000000000..d2ce1d909 --- /dev/null +++ b/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/nuget3.lg @@ -0,0 +1,2 @@ +# template +- template \ No newline at end of file diff --git a/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/nuget3.lu b/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/nuget3.lu new file mode 100644 index 000000000..e7b263a4b --- /dev/null +++ b/packages/dialog/test/commands/dialog/nuget/nuget3/1.0.0/duplicated/nuget3.lu @@ -0,0 +1,2 @@ +# intent +- intent \ No newline at end of file diff --git a/packages/dialog/test/commands/dialog/projects/project2/multiple.dialog b/packages/dialog/test/commands/dialog/projects/project2/multiple.dialog index e69de29bb..9e26dfeeb 100644 --- a/packages/dialog/test/commands/dialog/projects/project2/multiple.dialog +++ b/packages/dialog/test/commands/dialog/projects/project2/multiple.dialog @@ -0,0 +1 @@ +{} \ No newline at end of file