how to make a model have a mandatory field in the database but ignore it in swagger? I already used [JSONIGNORE] but it is still mandatory in swagger.
CodePudding user response:
For that, you should 2 separate models, as this looks like 2 separate layers, one for presentation and another for persistence.
Then you would have one model for users, that use the app, and the other for data that you store. However, this looks very strange, because users will get failed requests for a property that is not required (that's what they will see in swagger), but errors will show up in database.
CodePudding user response: