![]() ![]() ![]() What you are trying to archive its perfectly possible but if you want to use you Entity as request body, you must make all the fields nullable, otherwise the underlying Json serializer will not be able to create the new instance of your model to pass the validations and generate the constraint violation report. There is some recommendations to work with kotlin an Jax-RS and Hibernate-Panache here. This is similar to when you try to create a new object but do not provide the required arguments in the constructor. You are having an issue with the nulatibility of your properties, as you can see even tough you are defining var properties some of them are not nullable ? so because you are deserializing a json message, the input of the rest services, Jackson is not being able to create the new instance of your model class user because some of the required fields are not present. `.User`, problem: Parameter specified as non-null is null: This is the response I'm getting right now when I hit the createUser endpoint: .exc.ValueInstantiationException: Cannot construct instance of But I'd also like to make sure invalid requests get handled nicely when the request isn't valid. Var email: createdAt: LocalDateTime? = updatedAt: LocalDateTime? = null,Īnd for the completeness, this is my UserRepository: UserRepository : PanacheRepositoryĬreating a user does work, when I'm sure the request is valid. Var id: UUID? = fullName: = "email may not be blank") This is my UserResource for the createUser POST request: user: User) : CreateUserResponse =Īnd this is my User entity: class User = "UUID") I want to display a correct and understandable message to the user when the request isn't valid. My challenge right now is that exception handling is not correctly done. I'm trying to create a simple users endpoint using RestEasy, Panache, and Hibernate. I'm currently creating an application in Quarkus, using Kotlin. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |