I need to develop a Mule API ( 4.4 Runtime ) with openapi: 3.0.0 The endpoint is a POST with the following request payload :
{
  "Employee": {
     "Address": {
        "City": "a",
        "Country": "aaa"
      }
  }
}
Here is the relevant section of the OpenAPI 3.0 spec :
    openapi: "3.0.0"
paths:
  /search:
    post:
      tags:
      - SearchUser
      summary: Search for Users
      operationId: getUser
      requestBody:
        description: User Request Object
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RequestComp'
        required: true
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ResponseComp'
        '400':
          description: Bad request
          content: {}
        '404':
          description: User not found
          content: {}
        '405':
          description: Validation exception
          content: {}
      
components:
  schemas:
    RequestComp:
      type: object
      properties:
        Employee:
          $ref: '#/components/schemas/EmployeeComp'
    EmployeeComp:
      type: object
      properties:
        Address:
          $ref: '#/components/schemas/AddressComp'
    AddressComp:
      type: object
      properties:
        City:
          type: string
          required: true
          nullable: false
          minLength: 1
        Country:
          type: string
          required: true
          nullable: false
          minLength: 1
    ResponseComp:
      type: object
      properties:
        City:
          type: string
        Country:
          type: string
So I can validate individual elements like 'City' and 'Country' to not be null but how do I prevent following request ? ( presently its not being flagged as invalid : )
    {
        "Address": {
           "City": "a",
           "Country": "aaa"
        }
    }
 
    