jikan-me / jikan-rest

The REST API for Jikan
https://docs.api.jikan.moe/
MIT License
413 stars 268 forks source link

🐛 Anime::getBroadcastAttribute() function causes an error when adapting the "broadcast" attribute value #542

Closed nicodg73 closed 1 week ago

nicodg73 commented 2 weeks ago

Is there an existing issue for this?

Current Behavior

The API has returned an error: TypeError Status code: 0 Message: App\Anime::adaptBroadcastValue(): Argument #1 ($broadcast) must be of type array|string|null, MongoDB\Model\BSONDocument given, called in /app/app/Anime.php on line 120 Trace: /app/app/Anime.php on line 410

Expected Behavior

The API should have returned a successful response with data.

Steps To Reproduce

Http Request: `GET /v4/random/anime

Environment

- OS: Debian 12
- Browser: Chrome 126
- Docker: 26.1.4

Anything else?

My api is in a docker container and got data (i executed the indexer and anime fetching was done).

Get random manga works Get random characters return the same one

pushrbx commented 2 weeks ago

We recently made a change to Jikan lib which changed the type of the broadcast attribute. However in the db we still have instances where the old version exists, so this fails. /app/app/Anime.php on line 120 <-- around this line we need a type check whether the value for the broadcast attribute from the db is the old or the new one. Or we don't need the call to the adaptBroadcastValue function. :thinking: