-
Notifications
You must be signed in to change notification settings - Fork 4.4k
(assertions): support multiple messages by logicalId in Annotations #18840
Copy link
Copy link
Closed
Labels
@aws-cdk/assertionsRelated to the @aws-cdk/assertv2 packageRelated to the @aws-cdk/assertv2 packageeffort/mediumMedium work item – several days of effortMedium work item – several days of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p1
Description
Description
Annotations in @aws-cdk/assertions cannot has multiple messages by logicalId because Messages is following type:
export type Messages = {
[logicalId: string]: SynthesisMessage;
}But Annotations in @aws-cdk/core can add multiple massages (info, warning and error) to same node because messages is just metadata of Node.
I think it is better that Annotations in @aws-cdk/assertions also handle multiple messages by logicalId.
Use Case
If this feature was implemented, when the aspect add multiple annotations to same node as this comment, users can test it.
Proposed Solution
Modifing type of Messages is needed.
from:
export type Messages = {
[logicalId: string]: SynthesisMessage;
}to:
export type Messages = {
[logicalId: string]: SynthesisMessage[];
}To do that safely, first I think it is better to try to type section and other private modules with generics <T>.
Other information
No response
Acknowledge
- I may be able to implement this feature request
- This feature might incur a breaking change
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/assertionsRelated to the @aws-cdk/assertv2 packageRelated to the @aws-cdk/assertv2 packageeffort/mediumMedium work item – several days of effortMedium work item – several days of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p1