Skip to content

Broken server-side serialization on serverOnly models #4427

Closed

Description

@Spearhead1038

Describe the bug

I use a wrapper model to serialize the list of another class, since upgrading to serverpod v3 I get (only when serverOnly=true):


ERROR: No deserialization found for type List<Article>
#0      SerializationManager.deserialize (package:serverpod_serialization/src/serialization.dart:108:5)
#1      Protocol.deserialize (package:app_server/src/generated/protocol.dart:1383:18)
#2      new ArticleList.fromJson (package:app_server/src/generated/article/article_list.dart:32:31)
#3      Service.fetchArticlesForCategory (package:app_server/src/services/service.dart:49:32)

To reproduce

article.spy.yml

class: Article
serverOnly: true
fields:
  name: String
  price: double

article_list.spy.yml

class: ArticleList
serverOnly: true
fields:
    results: List<Article>

service.dart

 import 'package:app_server/src/generated/protocol.dart';
      
 final protocol = Protocol(); 
 final articles = protocol.decode<ArticleList>(json);

Expected behavior

I expected serverOnly to prevent the client from serializing the model, while server-side serialization should always work, regardless of whether serverOnly is true or false.

Library version

  • Serverpod version: 3.0.1
  • Dart SDK version: 3.10.1 (stable)
  • Flutter 3.38.3 (stable)

Platform information

  • OS: Arch Linux
  • Kernel: 6.17.9-arch1-1
  • Architecture: x86_64

Additional context

No response

How experienced are you with this library?

Intermediate - Familiar with the basics or have used it in a few projects

Are you interested in working on a PR for this?

  • I want to work on this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions