File tree 3 files changed +6
-7
lines changed
3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ Malli is in well matured [alpha](README.md#alpha).
16
16
17
17
## 0.17.0 (UNRELEASED)
18
18
19
+ * Don't output ` :definitions nil ` in swagger. [ #1134 ] ( https://github.com/metosin/malli/issues/1134 )
19
20
* ** BREAKING** : ` :gen/fmap ` property requires its schema to create a generator.
20
21
* previous behavior defaulted to a ` nil ` -returning generator, even if the schema doesn't accept ` nil `
21
22
* use ` :gen/return nil ` property to restore this behavior
Original file line number Diff line number Diff line change 184
184
parameters (:parameters expanded)
185
185
responses (:responses expanded)
186
186
definitions (apply merge
187
+ (:definitions acc)
187
188
(concat
188
189
(->> responses vals (map (comp :definitions :schema )))
189
190
(->> parameters (map (comp :definitions :schema )))))]
190
191
(-> acc (dissoc k) (merge expanded)
191
- (update :definitions merge definitions )
192
+ (merge ( when-not ( empty? definitions ) [ :definitions definitions ]) )
192
193
dissoc-non-root-definitions))
193
194
acc))
194
195
x x)
Original file line number Diff line number Diff line change 333
333
334
334
(deftest swagger-spec-test
335
335
(testing " generates swagger for ::parameters and ::responses w/ basic schema"
336
- (is (= {:definitions nil
337
- :parameters [{:description " "
336
+ (is (= {:parameters [{:description " "
338
337
:in " body"
339
338
:name " body"
340
339
:required true
439
438
{:registry registry})}}})))))
440
439
441
440
(testing " no schema in responses ignored"
442
- (is (= {:definitions nil
443
- :responses {200 {:description " " :schema {:type " string" }}
441
+ (is (= {:responses {200 {:description " " :schema {:type " string" }}
444
442
500 {:description " fail" }}}
445
443
(swagger/swagger-spec {::swagger/responses
446
444
{500 {:description " fail" }
518
516
::swagger/responses {200 {:schema #'Success}}}))))
519
517
(testing " ::parameters :query w/ var schema"
520
518
; ; NB! all refs get inlined!
521
- (is (= {:definitions nil
522
- :parameters [{:description " "
519
+ (is (= {:parameters [{:description " "
523
520
:in " query"
524
521
:name :a
525
522
:required true
You can’t perform that action at this time.
0 commit comments