Skip to content

Commit 1affaab

Browse files
committed
fix(genui): remove duplicate 'component' in required list in prompt
- Use a `Set` to avoid duplicate entries when generating the `required` list for components in the catalog schema. - Update golden files to reflect the fix. - Add mock asset handler to `travel_app` tests to fix failing test. Follow-up for #873.
1 parent f9f9e21 commit 1affaab

9 files changed

Lines changed: 2 additions & 10 deletions

packages/genui/lib/src/facade/prompt_builder.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,10 @@ final class _BasicPromptBuilder extends PromptBuilder {
410410
'component': {'const': item.name},
411411
...item.dataSchema.value['properties'] as Map<String, dynamic>,
412412
},
413-
'required': [
413+
'required': {
414414
'component',
415415
...?item.dataSchema.value['required'] as List?,
416-
],
416+
}.toList(),
417417
},
418418
],
419419
'unevaluatedProperties': false,

packages/genui/test/facade/prompt_builder_test.golden/all_operations_with_dataModel_false.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ When constructing UI, you must output a VALID A2UI JSON object representing one
515515
}
516516
},
517517
"required": [
518-
"component",
519518
"component",
520519
"text"
521520
]

packages/genui/test/facade/prompt_builder_test.golden/all_operations_with_dataModel_true.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,6 @@ When constructing UI, you must output a VALID A2UI JSON object representing one
517517
}
518518
},
519519
"required": [
520-
"component",
521520
"component",
522521
"text"
523522
]

packages/genui/test/facade/prompt_builder_test.golden/create_and_update_with_dataModel_false.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ When constructing UI, you must output a VALID A2UI JSON object representing one
513513
}
514514
},
515515
"required": [
516-
"component",
517516
"component",
518517
"text"
519518
]

packages/genui/test/facade/prompt_builder_test.golden/create_and_update_with_dataModel_true.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ When constructing UI, you must output a VALID A2UI JSON object representing one
515515
}
516516
},
517517
"required": [
518-
"component",
519518
"component",
520519
"text"
521520
]

packages/genui/test/facade/prompt_builder_test.golden/create_only_with_dataModel_false.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ When constructing UI, you must output a VALID A2UI JSON object representing one
512512
}
513513
},
514514
"required": [
515-
"component",
516515
"component",
517516
"text"
518517
]

packages/genui/test/facade/prompt_builder_test.golden/create_only_with_dataModel_true.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,6 @@ When constructing UI, you must output a VALID A2UI JSON object representing one
514514
}
515515
},
516516
"required": [
517-
"component",
518517
"component",
519518
"text"
520519
]

packages/genui/test/facade/prompt_builder_test.golden/update_only_with_dataModel_false.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,6 @@ When constructing UI, you must output a VALID A2UI JSON object representing one
505505
}
506506
},
507507
"required": [
508-
"component",
509508
"component",
510509
"text"
511510
]

packages/genui/test/facade/prompt_builder_test.golden/update_only_with_dataModel_true.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ When constructing UI, you must output a VALID A2UI JSON object representing one
507507
}
508508
},
509509
"required": [
510-
"component",
511510
"component",
512511
"text"
513512
]

0 commit comments

Comments
 (0)