Forum Discussion

HenrikHL's avatar
HenrikHL
Frequent Contributor
4 years ago
Solved

allOf structure renders but does not validate

Hi all,

 

I have the following allOf structure:

    shipmentEquipmentCommon:
      type: object
      allOf:
        - $ref: '#/components/schemas/equipmentReference'
        - $ref: '#/components/schemas/verifiedGrossMass'
        - $ref: '#/components/schemas/weightUnit'
        - $ref: '#/components/schemas/cargoGrossWeight'
        - activeReeferSettings:
          type: object
          properties:
            activeReeferSettings:
              type: object
              description: specifies the settings for an active reefer container used to a shipment.
              allOf:
                - $ref: '#/components/schemas/temperatureMin'
                - $ref: '#/components/schemas/temperatureMax'
                - $ref: '#/components/schemas/temperatureUnit'
                - $ref: '#/components/schemas/humidityMin'
                - $ref: '#/components/schemas/humidityMax'
                - $ref: '#/components/schemas/ventilationMin'
                - $ref: '#/components/schemas/ventilationMax'

all of the $ref - references are defined in the following manner:

    equipmentReference:
      type: object
      properties:
        equipmentReference:
          type: string
          maxLength: 15
          description: 'Description...'
          example: APZU4812090

The structure renders correct in SwaggerHub:

But does not validate:

What am I doing wrong? Is there something I have misunderstood?

  • On line 228, change

            - activeReeferSettings:
              type: object

    to

            - type: object

     

2 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    On line 228, change

            - activeReeferSettings:
              type: object

    to

            - type: object