microsoft / kiota-typescript

TypeScript libraries for Kiota-generated API clients.
https://aka.ms/kiota/docs
MIT License
32 stars 25 forks source link

Cannot read properties of null (reading 'map') #1151

Closed illunix closed 3 months ago

illunix commented 3 months ago

I use v1.13.0 Can someone help me resolve this, somehow Kiota can't handle null values image image

andrueastman commented 3 months ago

Thanks for raising this @illunix

Any chance you can share the path being called as well as the openApi description for the path? Are you able to determine which property is null that was expected to be a collection?

illunix commented 3 months ago

Everything in my response is expected, I will provide you open api description later

illunix commented 3 months ago

@andrueastman Get companies request swagger.json

baywet commented 3 months ago

Hi @illunix Thanks for the additional information. This is caused by a lack of defensive check here. https://github.com/microsoft/kiota-typescript/blob/8c76a375bfab29d66e7ebe186f71342a1a2a4f54/packages/serialization/json/src/jsonParseNode.ts#L53

Would you be willing to submit a pull request to address this issue?

illunix commented 3 months ago

You mean it's missing something like @baywet


if (typeOfX === "null") {

}
baywet commented 3 months ago

more something like

if(!Array.isArray(this._jsonNode)) return undefined;
SrRickGrimes commented 3 months ago

same issue here. I am getting this exception:

TypeError: Cannot read properties of null (reading 'map') at JsonParseNode.getCollectionOfPrimitiveValues