Dinuka Kasun Medis
Dinuka Kasun Medis

Reputation: 75

Define an array that can not contain null in Swagger 2.0

    required:
          - property_1
        properties:
          property_1:
            type: array
            items:
              type: string

In this way property_1 = null not accept, but I need a way to property_1 not allow for [null,null,"string_1"] in Swagger 2.0

Upvotes: 1

Views: 1600

Answers (1)

Helen
Helen

Reputation: 97677

Your definition is correct. Swagger 2.0 does not support null values in payloads.

Upvotes: 3

Related Questions