LearningProcesss / boardgamegeekjsclient

Typescript written API wrapper for Boardgamegeek XML2 API
MIT License
18 stars 6 forks source link

Exception thrown when accessing a game without versions #36

Closed rgembalik closed 1 year ago

rgembalik commented 2 years ago

I stumbled upon this use case:

await client.thing.query({id: [21659], versions: 1})
Uncaught TypeError: Cannot read properties of undefined (reading 'item')
    at Object.using (node_modules\boardgamegeekclient\dist\cjs\dto\concrete\BggThingDto.js:148:36)
    at e.parseJsonDeserializeProperty (node_modules\jackson-js\dist\lib.node.js:16:92732)
    at e.deepTransform (node_modules\jackson-js\dist\lib.node.js:16:75148)
    at e.parseIterable (node_modules\jackson-js\dist\lib.node.js:16:99411)
    at e.deepTransform (node_modules\jackson-js\dist\lib.node.js:16:75380)
    at e.transform (node_modules\jackson-js\dist\lib.node.js:16:71069)
    at node_modules\boardgamegeekclient\dist\cjs\dto\dtoparser\concrete\BggThingDtoParser.js:12:33
    at new Promise (<anonymous>)
    at BggThingDtoParser.jsonToDto (node_modules\boardgamegeekclient\dist\cjs\dto\dtoparser\concrete\BggThingDtoParser.js:11:16)

It works ok when running without versions. My assumption is that it's because versions is a self-closed tag in this case. https://api.geekdo.com/xmlapi2/thing?id=21659&versions=1

Any idea how to work around it?

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.7.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

LearningProcesss commented 1 year ago

I stumbled upon this use case:

await client.thing.query({id: [21659], versions: 1})
Uncaught TypeError: Cannot read properties of undefined (reading 'item')
    at Object.using (node_modules\boardgamegeekclient\dist\cjs\dto\concrete\BggThingDto.js:148:36)
    at e.parseJsonDeserializeProperty (node_modules\jackson-js\dist\lib.node.js:16:92732)
    at e.deepTransform (node_modules\jackson-js\dist\lib.node.js:16:75148)
    at e.parseIterable (node_modules\jackson-js\dist\lib.node.js:16:99411)
    at e.deepTransform (node_modules\jackson-js\dist\lib.node.js:16:75380)
    at e.transform (node_modules\jackson-js\dist\lib.node.js:16:71069)
    at node_modules\boardgamegeekclient\dist\cjs\dto\dtoparser\concrete\BggThingDtoParser.js:12:33
    at new Promise (<anonymous>)
    at BggThingDtoParser.jsonToDto (node_modules\boardgamegeekclient\dist\cjs\dto\dtoparser\concrete\BggThingDtoParser.js:11:16)

It works ok when running without versions. My assumption is that it's because versions is a self-closed tag in this case. https://api.geekdo.com/xmlapi2/thing?id=21659&versions=1

Any idea how to work around it?

Hi @rgembalik, thanks for pointing out this issue that is solved by 1.7.2 release.