|
150 | 150 | ))
|
151 | 151 |
|
152 | 152 | (fact "Optional-key default metadata"
|
153 |
| - (rsjs/properties {(with-meta (s/optional-key :foo) {:default "bar"}) s/Str} :swagger) |
| 153 | + (rsjs/properties {(with-meta (s/optional-key :foo) {:default "bar"}) s/Str}) |
154 | 154 | => {:foo {:type "string" :default "bar"}}
|
155 | 155 |
|
156 | 156 | (fact "nil default is ignored"
|
157 |
| - (rsjs/properties {(with-meta (s/optional-key :foo) {:default nil}) s/Str} :swagger) |
| 157 | + (rsjs/properties {(with-meta (s/optional-key :foo) {:default nil}) s/Str}) |
158 | 158 | => {:foo {:type "string"}})
|
159 | 159 |
|
160 | 160 | (fact "pfnk schema"
|
161 |
| - (rsjs/properties (pfnk/input-schema (p/fnk [{x :- s/Str "foo"}])) :swagger) |
| 161 | + (rsjs/properties (pfnk/input-schema (p/fnk [{x :- s/Str "foo"}]))) |
162 | 162 | => {:x {:type "string" :default "foo"}})
|
163 | 163 |
|
164 | 164 | (fact "pfnk schema - nil default is ignored"
|
165 |
| - (rsjs/properties (pfnk/input-schema (p/fnk [{x :- s/Str nil}])) :swagger) |
| 165 | + (rsjs/properties (pfnk/input-schema (p/fnk [{x :- s/Str nil}]))) |
166 | 166 | => {:x {:type "string"}}))
|
167 | 167 |
|
168 | 168 | (fact "Describe"
|
|
204 | 204 | (rsjs/->swagger schema) => {:$ref "#/definitions/schema"})
|
205 | 205 |
|
206 | 206 | (fact "extra metadata is present on schema objects"
|
207 |
| - (rsjs/schema-object schema :swagger) => (contains |
| 207 | + (rsjs/schema-object schema) => (contains |
208 | 208 | {:properties {:name {:type "string"}
|
209 | 209 | :title {:type "string"}}
|
210 | 210 | :minProperties 1
|
|
228 | 228 | (facts "properties"
|
229 | 229 | (fact "s/Any -values are not ignored"
|
230 | 230 | (keys (rsjs/properties {:a s/Str
|
231 |
| - :b s/Any} :swagger)) |
| 231 | + :b s/Any})) |
232 | 232 | => [:a :b])
|
233 | 233 |
|
234 | 234 | (fact "nil-values are ignored"
|
235 |
| - (keys (rsjs/properties {:a s/Str, :b Currency} :swagger)) |
| 235 | + (keys (rsjs/properties {:a s/Str, :b Currency})) |
236 | 236 | => [:a])
|
237 | 237 |
|
238 | 238 | (fact "s/Keyword -keys are ignored"
|
239 | 239 | (keys (rsjs/properties {:a s/Str
|
240 |
| - s/Keyword s/Str} :swagger)) |
| 240 | + s/Keyword s/Str})) |
241 | 241 | => [:a])
|
242 | 242 |
|
243 | 243 | (fact "Class -keys are ignored"
|
244 | 244 | (keys (rsjs/properties {:a s/Str
|
245 |
| - s/Str s/Str} :swagger)) |
| 245 | + s/Str s/Str})) |
246 | 246 | => [:a])
|
247 | 247 |
|
248 | 248 | (fact "Required keyword-keys are used"
|
249 | 249 | (keys (rsjs/properties {:a s/Str
|
250 |
| - (s/required-key :b) s/Str} :swagger)) |
| 250 | + (s/required-key :b) s/Str})) |
251 | 251 | => [:a :b])
|
252 | 252 |
|
253 | 253 | (fact "Required non-keyword-keys are NOT ignored"
|
254 | 254 | (keys (rsjs/properties {:a s/Str
|
255 |
| - (s/required-key "b") s/Str} :swagger)) |
| 255 | + (s/required-key "b") s/Str})) |
256 | 256 | => [:a "b"])
|
257 | 257 |
|
258 | 258 | (fact "s/Any -keys are ignored"
|
259 | 259 | (keys (rsjs/properties {:a s/Str
|
260 |
| - s/Any s/Str} :swagger)) |
| 260 | + s/Any s/Str})) |
261 | 261 | => [:a])
|
262 | 262 |
|
263 | 263 | (fact "with unknown mappings"
|
264 | 264 | (fact "by default, exception is thrown"
|
265 | 265 | (rsjs/properties {:a String
|
266 |
| - :b java.util.Vector} :swagger) => (throws IllegalArgumentException)) |
| 266 | + :b java.util.Vector}) => (throws IllegalArgumentException)) |
267 | 267 | (fact "unknown fields are ignored ig *ignore-missing-mappings* is set"
|
268 | 268 | (binding [rsjs/*ignore-missing-mappings* true]
|
269 | 269 | (keys (rsjs/properties {:a String
|
270 |
| - :b java.util.Vector} :swagger)) => [:a]))) |
| 270 | + :b java.util.Vector})) => [:a]))) |
271 | 271 |
|
272 | 272 | (fact "Keeps the order of properties intact"
|
273 | 273 | (keys (rsjs/properties (linked/map :a String
|
|
277 | 277 | :e String
|
278 | 278 | :f String
|
279 | 279 | :g String
|
280 |
| - :h String) :swagger)) |
| 280 | + :h String))) |
281 | 281 | => [:a :b :c :d :e :f :g :h])
|
282 | 282 |
|
283 | 283 | (fact "Ordered-map works with sub-schemas"
|
284 | 284 | (rsjs/properties (rsc/with-named-sub-schemas (linked/map :a String
|
285 | 285 | :b {:foo String}
|
286 |
| - :c [{:bar String}] )) :swagger) |
| 286 | + :c [{:bar String}]))) |
287 | 287 | => anything)
|
288 | 288 |
|
289 | 289 | (fact "referenced record-schemas"
|
290 | 290 | (s/defschema Foo (s/enum :one :two))
|
291 | 291 | (s/defschema Bar {:key Foo})
|
292 | 292 |
|
293 | 293 | (fact "can't get properties out of record schemas"
|
294 |
| - (rsjs/properties Foo :swagger)) => (throws AssertionError) |
| 294 | + (rsjs/properties Foo)) => (throws AssertionError) |
295 | 295 |
|
296 | 296 | (fact "nested properties work ok"
|
297 |
| - (keys (rsjs/properties Bar :swagger)) => [:key]))) |
| 297 | + (keys (rsjs/properties Bar)) => [:key]))) |
298 | 298 |
|
299 | 299 | (facts "additional-properties"
|
300 | 300 | (fact "No additional properties"
|
301 |
| - (rsjs/additional-properties {:a s/Str} :swagger) |
| 301 | + (rsjs/additional-properties {:a s/Str}) |
302 | 302 | => false)
|
303 | 303 |
|
304 | 304 | (fact "s/Keyword"
|
305 |
| - (rsjs/additional-properties {s/Keyword s/Bool} :swagger) |
| 305 | + (rsjs/additional-properties {s/Keyword s/Bool}) |
306 | 306 | => {:type "boolean"})
|
307 | 307 |
|
308 | 308 | (fact "s/Any"
|
309 |
| - (rsjs/additional-properties {s/Any s/Str} :swagger) |
| 309 | + (rsjs/additional-properties {s/Any s/Str}) |
310 | 310 | => {:type "string"})
|
311 | 311 |
|
312 | 312 | (fact "s/Str"
|
313 |
| - (rsjs/additional-properties {s/Str s/Bool} :swagger) |
| 313 | + (rsjs/additional-properties {s/Str s/Bool}) |
314 | 314 | => {:type "boolean"})
|
315 | 315 |
|
316 | 316 | (fact "s/Int"
|
317 |
| - (rsjs/additional-properties {s/Int s/Str} :swagger) |
| 317 | + (rsjs/additional-properties {s/Int s/Str}) |
318 | 318 | => {:type "string"}))
|
0 commit comments