-
Notifications
You must be signed in to change notification settings - Fork 374
chore: copy Constructor in 'shared' lib #1501
Conversation
|
@a-b-r-o-w-n @boydc2014 please review the current pattern we use. |
a-b-r-o-w-n
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I think this is a solid design. Tactically, I would like to see some more error handling.
Composer/packages/lib/shared/__tests__/copyUtils/copyAdaptiveAction.test.ts
Outdated
Show resolved
Hide resolved
Composer/packages/lib/shared/src/copyUtils/shallowCopyAdaptiveAction.ts
Outdated
Show resolved
Hide resolved
Composer/packages/lib/shared/src/copyUtils/copyAdaptiveActionList.ts
Outdated
Show resolved
Hide resolved
Composer/packages/lib/shared/src/copyUtils/copyAdaptiveActionList.ts
Outdated
Show resolved
Hide resolved
a-b-r-o-w-n
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some test feedback
Composer/packages/lib/shared/__tests__/copyUtils/copyAdaptiveAction.test.ts
Outdated
Show resolved
Hide resolved
Composer/packages/lib/shared/__tests__/copyUtils/copyAdaptiveAction.test.ts
Outdated
Show resolved
Hide resolved
Composer/packages/lib/shared/__tests__/copyUtils/copyAdaptiveAction.test.ts
Outdated
Show resolved
Hide resolved
| copy.prompt = await externalApi.copyLgTemplate(input.prompt, nodeId); | ||
| } | ||
|
|
||
| if (input.unrecognizedPrompt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar things like this "unrecoginzedPrompt". Not sure this is required or not, just want to make sure we leverage the type checking as much as possible.
Because we control the "constructor", we could be able to enforce more strict type (less optional field). Not for just reducing 1 or 2 line codes, more importantly, have the type enforced at first place, will reduce the possible state in our system, means we will reduce the overall complexity of the system.
|
Looks good, i leave a few comments about if we can remove some checking, by enforcing the structure more strictly, which would help reduce the overall complexity. It might not be the major focus of this PR, but it's a good direction to follow. |
|
I got Dong's point, we have declared some fields as required in sdk but during construction we missed the default values for some required fields. Though the 'copy constructor' should respect the original input to copy the data as it was, it's still a 'constructor' which means that it should generate default values for those required fields. |
|
However, I know a strange behavior which makes me cannot assgin a default value for those propmpt fields: |
8c50877 to
2d1c076
Compare
|
|
@cwhitten I've added default fields for |
909ed32 to
126eb5a
Compare

Description
Implement the copy constructor in dialogFactory to enable action deep clone.
Obi types need sepcial treatment
Task Item
refs #1193, #1191
Type of change
Please delete options that are not relevant.
Checklist
Screenshots
Please include screenshots or gifs if your PR include UX changes.