Kaiteki-Fedi / Kaiteki

The comfy SNS client for everything, everywhere

Home Page:https://kaiteki.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[friendica] Returned array instead of object on /api/v1/markers

kr428 opened this issue · comments

Error Type

_TypeError

Error Message

type 'List' is not a subtype of type 'Map<String, dynamic>' in type cast

Stack Trace

#0      KaitekiResponseExtensions.fromJson (package:kaiteki_core/src/http/extensions.dart:16)
#1      KaitekiJsonDeserializationResopnseExtensions.fromResponse (package:kaiteki_core/src/http/extensions.dart:28)
#2      KaitekiJsonDeserializationResopnseExtensions.fromResponse.<anonymous closure> (package:kaiteki_core/src/http/extensions.dart:28)
<asynchronous suspension>
#3      SharedMastodonAdapter.getNotifications (package:kaiteki_core/src/social/backends/mastodon/shared_adapter.dart:398)
<asynchronous suspension>
#4      NotificationService.build (package:kaiteki/fediverse/services/notifications.dart:51)
<asynchronous suspension>
#5      FutureHandlerProviderElementMixin.handleFuture.<anonymous closure>.<anonymous closure> (package:riverpod/src/async_notifier/base.dart:339)
<asynchronous suspension>

Additional information

Platform: android: SP1A.210812.016.M515FXXS5DWG1
Version: Weekly 2023-47 (1700441989)
Backend: (loma.ml, MastodonAdapter, ApiType.mastodon)

Note: This is related to a Friendica backend. Not sure where to best report such issues. Cc'ing @annando ? This is most likely a difference in Friendicas Mastodon API implementation?

We would need to see a sample of the JSON document that triggered the error to be able to troubleshoot this error.

Also reading the API docs (https://docs.joinmastodon.org/methods/markers/#get) friendica must be returning everything but the expected object.

Reading the linked issue, it seems to be fixed on Friendica's side.

Our API endpoint was wrongly returning an empty array [] when we didn't have available markers, now it just returns an empty object {} which may or may not trip the markers.notifications lookup:

final markers =
await client.getMarkers(const {MarkerTimeline.notifications});
marker = markers.notifications;

It shouldn't since the object properties are nullable.

A Friendica user has successfully tested the updated endpoint with Kaiteki! 🎉