@@ -906,7 +906,10 @@ instance ToJSON SecurityScheme where
906906 toJSON = genericToJSONWithSub "type" (jsonPrefix "securityScheme")
907907
908908instance ToJSON Schema where
909− toJSON = omitEmpties . genericToJSONWithSub "paramSchema" (jsonPrefix "schema")
909+ toJSON = omitEmptiesExcept f . genericToJSONWithSub "paramSchema" (jsonPrefix "schema")
910+ where
911+ f "items" (Array _) = True
912+ f _ _ = False
910913
911914instance ToJSON Header where
912915 toJSON = genericToJSONWithSub "paramSchema" (jsonPrefix "header")
@@ -985,7 +988,10 @@ instance ToJSON (CollectionFormat t) where
985988 toJSON CollectionMulti = "multi"
986989
987990instance ToJSON (ParamSchema t) where
988− toJSON = omitEmpties . genericToJSONWithSub "items" (jsonPrefix "paramSchema")
991+ toJSON = omitEmptiesExcept f . genericToJSONWithSub "items" (jsonPrefix "paramSchema")
992+ where
993+ f "items" (Array _) = True
994+ f _ _ = False
989995
990996-- =======================================================================
991997-- Manual FromJSON instances