Hello there, how are you doing?
So, I want to have a PATCH endpoint and be able to change the resource partially using theTypes.
Here’s my Type:
class User(types.Type): id = validators.Integer() username = validators.String(max_length=100)
Here’s my endpoint (kept it more brief):
def edit_user(username: str, user: User) -> User: user_to_edit = get_user(username) if not user_to_edit: raise exceptions.NotFound() user_to_edit.username = user.username return user_to_edit
The problem is that the
id field is required, so if I send just the
username to be changed, the validation system fails before.
Is there a way to solve this?