Skip to content
Discussion options

You must be logged in to vote

dynamic is not supported as a type in either the models or endpoint params/return values.

Why do you want to return this JSON manually? You could just as easily create a model like so:

class: MyResponse
fields:
  userInfo: model:auth:userInfo?
  verificationCode: String?
  isDetectedNewDevice: bool
  message: String
  statusCode: int

If you use the generated class from the above definition, Serverpod will manage the Serialization for you. Hence you will not need to do any manual conversion and you get a typed interface!

See: https://docs.serverpod.dev/concepts/models

Endpoints also supports managing exceptions for you, you can simply throw a serializable exception and Serverpod will autom…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by onurcagilci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2721 on September 09, 2024 07:41.