Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: LabelerServices.toJson does not save type #1876

Open
JetA2 opened this issue Jan 9, 2025 · 0 comments
Open

Bug Report: LabelerServices.toJson does not save type #1876

JetA2 opened this issue Jan 9, 2025 · 0 comments
Assignees
Labels
bug Something isn't working untriaged A label Indicating this Issue has not yet been initiated.

Comments

@JetA2
Copy link

JetA2 commented Jan 9, 2025

Hi,

Thank you for this excellent library!

I would like to save the moderation preferences to use for moderation when offline.
I ran into a problem which seems to be caused by the following bug:

Bug Behavior

When a LabelerServices object is saved as JSON, the type is not saved for the views.
When the object is deserialized, the views are created with the "unknown" type.

Expected Behavior

A serialized LabelerServices object can be deserialized to an identical object.

Step to Reproduce

final prefs = await service.actor.getPreferences();
final moderationPrefs = prefs.data.getModerationPrefs();

final services = await service.labeler.getServices(
  dids: moderationPrefs.moderationLabelers,
  detailed: true,
  headers: moderationPrefs.labelerHeaders,
);
final testJson = services.data.toJson();
final testObject = LabelerServices.fromJson(testJson);

assert(services.data == testObject);
@JetA2 JetA2 added bug Something isn't working untriaged A label Indicating this Issue has not yet been initiated. labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged A label Indicating this Issue has not yet been initiated.
Projects
None yet
Development

No branches or pull requests

2 participants