Nicodemus Ojwee
10/03/2020, 11:08 AM@Serializable
data class User(
var email: String = "",
@JsonIgnore var password: String = ""
)
Which annotation can i use on the password field to ignore it "only" in the http response but not within the application.
For example
Ignore it when:
get {
call.respond(User("email", "some password"))
}
Don't ignore it when:
fun checkUserPassword(email: String) {
val user = getUserPasswordFromDatabaseByEmail<User>(email)
// The print below does not work (I want it to work since it is not yet part of the response)
println(user.password)
}
Matias Reparaz
10/04/2020, 2:06 AMNicodemus Ojwee
10/04/2020, 8:54 AMMatteo Mirk
10/06/2020, 8:27 AMget {
call.respond(User("email", "some password").copy(password = ""))
}
you could even encapsulate the copying with empty values in an instance method or extension function declared in the router file/module.