Reputation: 1
I'm working on a spring boot project nowadays. And I totally love it. I've created my services, entities, repos. Everything seems ok for simple scenarios.
But the thing is , one of my entities has attributes(properties) as follows:
userID;
loginName;
email;
profiles;
createdDate;
lastModifiedDate;
I'm listing my services on swagger ui. When I try to call update service on swagger, lastModifiedDate criteria shouldn't be listed as an input property, I need to handle this property on the back end. Likewise, when I try to add a new user record from swagger, createdDate criteria shouldn't be listed as an input property, I need to handle this property on the back end.
I try to google this, but I couldn't find a relative answer so far. Do you have any recommendations ? Any links, documents. . . Or is it even possible ?
screenshots from swagger-ui :
Upvotes: 0
Views: 136
Reputation: 341
It's a good practice to separate entity
and api resonse
object. That way you can choose what fields to expose to api contract.
So in your case, create a new object without modifedOn and createdOn and use that in your controller
Upvotes: 2