title: Loopback 4 How to validate requestBody properties
body: <p>I'm looking for a way to prevent unwanted properties to be present in the requestBody as described in the associated Model </p>
  
  <p>Here is my model : </p>
  
  <pre><code>import { Model, model, property } from '@loopback/repository';
  
  @model({
     name: 'AwsS3',
     strict: true,
     description: 'AWS S3 Object description',
     properties: {
     Key: {
        type: 'String',
        required: 'true',
     },
     Bucket: {
        type: 'String',
        requied: 'true',
     },
   },
  })
  export class AwsS3 extends Model {
  @property({
     type: 'string',
     description: 'path/to/file',
     required: true,
  }) Key: string;
  
  @property({
     type: 'string',
     description: 'AWS-S3-Bucket-Name',
     required: true,
  })
  Bucket: string;
  
  constructor(data: AwsS3) {
    super(data);
   }
  }
  </code></pre>
  
  <p>I used it like this in the controller</p>
  
  <pre><code> function(@requestBody({
      required: true,
      description: 'aws object settings',
      content: {
         'application/json': {},
       },
     }) body : AwsS3
   ){
      console.log(body);
   }
  </code></pre>
  
  <p>It throws correctly when one of both properties is missing or in the wrong type.
  But if i send a json like bellow nothing is thrown and object is processed with the UnwantedProp</p>
  
  <pre><code>{
      Key: 'key',
      Bucket : 'bucket',
      UnwantedProp: 40
  }
  </code></pre>