File tree Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 20
20
(.setResolveFully true ))
21
21
contents (.readContents (OpenAPIV3Parser. ) api-spec nil parse-options)
22
22
paths (.getPaths (.getOpenAPI contents))]
23
- (mapv identity ( i/update-kvs paths identity #(i/path-item->data % handlers) ))))
23
+ (i/update-kvs paths identity #(i/path-item->data % handlers))))
24
24
25
25
(comment
26
26
(require '[clojure.pprint :as pp])
Original file line number Diff line number Diff line change 24
24
StringSchema
25
25
UUIDSchema]
26
26
[io.swagger.v3.oas.models.parameters
27
+ CookieParameter
27
28
HeaderParameter
28
29
PathParameter
29
30
QueryParameter
117
118
ByteArraySchema
118
119
(p/transform [_] any?)
119
120
121
+ nil
122
+ (p/transform [_] any?)
123
+
120
124
Schema
121
125
(p/transform [schema]
122
126
(if-let [t (first (.getTypes schema))]
125
129
(throw (Exception. (str " Unsupported schema" schema))))
126
130
(throw (Exception. " Missing schema" ))))
127
131
128
- nil
129
- (p/transform [_] any?)
130
-
131
132
; ; TODO: Better. The extra [] is there to help with merge-with into
132
133
PathParameter
133
134
(p/transform [param]
141
142
(p/transform [param]
142
143
{:query [(i/->param-schema param)]})
143
144
145
+ CookieParameter
146
+ (p/transform [param]
147
+ {:cookie [(i/->param-schema param)]})
148
+
144
149
; ; TODO: Handle more kinds of request-bodies
145
150
RequestBody
146
151
(p/transform [param]
Original file line number Diff line number Diff line change 13
13
(:import
14
14
[io.swagger.v3.oas.models.media
15
15
ArraySchema
16
+ BinarySchema
17
+ ByteArraySchema
16
18
ComposedSchema
17
19
Content
18
20
IntegerSchema
24
26
StringSchema
25
27
UUIDSchema]
26
28
[io.swagger.v3.oas.models.parameters
29
+ CookieParameter
27
30
HeaderParameter
28
31
PathParameter
29
32
QueryParameter
70
73
(is (= [:sequential string?]
71
74
(p/transform arr)))
72
75
(is (= [:sequential string?]
73
- (p/transform arr-json))))))
76
+ (p/transform arr-json)))))
77
+ (testing " byte array"
78
+ (is (= any? (p/transform (ByteArraySchema. )))))
79
+ (testing " binary"
80
+ (is (= any? (p/transform (BinarySchema. )))))
81
+ (testing " nil"
82
+ (is (= any? (p/transform nil )))))
74
83
75
84
(deftest string-formats
76
85
(testing " uuid"
119
128
(.setSchema (IntegerSchema. )))]
120
129
(is (= {:header [[:x int?]]}
121
130
(p/transform param)))))
131
+ (testing " cookie"
132
+ (let [param (doto (CookieParameter. )
133
+ (.setName " x" )
134
+ (.setRequired true )
135
+ (.setSchema (IntegerSchema. )))]
136
+ (is (= {:cookie [[:x int?]]}
137
+ (p/transform param)))))
122
138
(testing " required request body"
123
139
(let [media (doto (MediaType. )
124
140
(.setSchema (ObjectSchema. )))
You can’t perform that action at this time.
0 commit comments