required property swagger 2 code example

Example: swagger required field in object

components:
  schemas:
    ### =============================
    ###  Create Point Location Route
    ### =============================
    CreatePointLocation:
      type: object
      properties:
        branchId:
          type: string
        companyId:
          type: string
        name:
          type: string
        location:
          type: object
          required:
            - city
            - address
            - state
            - postcode
            - country
            - latitude
            - longitude
          properties:
            city:
              type: string
            address:
              type: string
            state:
              type: string
            postcode:
              type: integer
            country:
              type: string
            latitude:
              type: string
            longitude:
              type: string
        city:
          type: string
        state:
          type: string
        country:
          type: string
        postcode:
          type: integer
        pickUp:
          type: string
        dropOff:
          type: string
      required:
        - branchId
        - companyId
        - name
        - location
        - city
        - address
        - state
        - postcode
        - pickUp
        - dropOff

Tags:

Misc Example