There is no attribute to mark a particular field as required in apex.
Only annotations in apex rest are these : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation.htm
@ReadOnly
@RestResource(urlMapping='/yourUrl')
@HttpDelete
@HttpGet
@HttpPatch
@HttpPost
@HttpPut
Either you need to put the logic in the caller service, or if you want to put a logic in apex, then, you need to write the logic in Apex. Something like this.
Check required fields:
public static Boolean isRequestValid(MyRequest myRequest){
return String.isNotBlank(myRequest.UserName);
}
And other params as required.