[BUG] additionalData property in NotificationRequestItem seems to be typed incorrectly
PiotrOwsiak opened this issue · comments
In v 15.1.0 the 'additionalData' property in NotificationRequestItem is typed as:
export declare class NotificationRequestItem {
'additionalData'?: {
[key: string]: string;
};
but in the docs here https://docs.adyen.com/api-explorer/Webhooks/1/post/NOTIFICATION_OF_FRAUD#request-notificationItems-NotificationRequestItem-additionalData-metadata
the metadata property on 'additionalData' is described as object which would make it incompatible with type string.
Hi @PiotrOwsiak,
Thanks for raising this issue.
Unfortunately, we are not able to generate more accurate AdditionalData models due to dynamic key names in this object. i.e; index numbers, fraudCheck ID's and names, etc.
Therefore you'd need to separately parse the metadata value to a JSON object as a workaround.
I apologise for any inconvenience this might cause.
Kind Regards,
Wouter
Adyen
hey @wboereboom
thank you for reply but what I mean is that additionalData propery is just not typed correctly because it should be allowed to contain either string or again an object that is key-value probably again typed as string to string.
Here you can see what the problem is: https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBAE2AYwDYEMrDm9BnPOAOQhgEsAzM5dciAOwCVgBHAV2DxgEkZgBbOAG8AUHHFwA5OgQIydeulQARWukkB+AFzCxE-QG0A1sACeOrlDL0A5gF0LMK7YDce8QF83+6bPlkGJVUYdAA1ACZNHVF9QxNzOEtre0dnGzgAH2FjM1Tkh0SnZK93OBKPERFkBi44elJKaloA+h0ScioaBWZ2Th4+QQBeXX0ZOQUgtWjS-XkBAEYdSTn+eckAGhmJFfClnY2t8X5gEIQpkdjLlYBmPYHJQ7LSj03RvwmVNQjpy-EVxak-wOvzgOzuAkir1+x1O5xiIO2A1ugPujwq+gqFREQA
The original typing makes TS complain about metadata not being a string but the additionalDataV2 allows for nested objects like metadata and it allows this nested object to be again just a key value map of string to string.