You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Need way of marking server class for inclusion in client #993
Is your feature request related to a problem? Please describe.
Often a client and server need to share code. Currently with Serverpod, as far as I can tell you have to manually keep in sync two copies of any class that you need on both the client and server.
Describe the solution you'd like
There needs to be an annotation (e.g. @clientAndServer) that can be added to a server class to cause that class to be copied over verbatim into the client when serverpod generate is called.
When you run serverpod generate any classes defined in a yaml file in the protocol folder will generate client classes too. They are located in the client project, so I think what you want already exists.
I don't need record classes to be generated from a yaml description, I need an entire dart class to be copied from server to client. There are some non-record methods that I want to add to the shared class, and the yaml description doesn't allow for that.
Activity
Isakdl commentedon Jun 5, 2023
When you run
serverpod generateany classes defined in a yaml file in the protocol folder will generate client classes too. They are located in the client project, so I think what you want already exists.lukehutch commentedon Jun 5, 2023
I don't need record classes to be generated from a yaml description, I need an entire dart class to be copied from server to client. There are some non-record methods that I want to add to the shared class, and the yaml description doesn't allow for that.