|
197 | 197 | (def Id s/Int)
|
198 | 198 | (def Name s/Str)
|
199 | 199 | (def Street s/Str)
|
200 |
| -(s/defschema City (s/maybe (s/enum :tre :hki))) |
| 200 | +(s/defschema City (st/schema (s/maybe (s/enum :tre :hki)) |
| 201 | + {:openapi/description "a city"})) |
201 | 202 | (s/defschema Filters [s/Str])
|
202 | 203 | (s/defschema Address
|
203 | 204 | {:street Street
|
|
230 | 231 | :schema {:type "string"}}
|
231 | 232 | {:name "city"
|
232 | 233 | :in "query"
|
233 |
| - :description "" |
| 234 | + :description "a city" |
234 | 235 | :required false
|
235 |
| - :schema {:oneOf [{:enum [:tre :hki], :type "string"} ;from set |
| 236 | + :schema {:description "a city" |
| 237 | + :oneOf [{:enum [:tre :hki], :type "string"} ;from set |
236 | 238 | {:type "null"}]}}
|
237 | 239 | {:name "street"
|
238 | 240 | :in "query"
|
|
264 | 266 | {:type "object"
|
265 | 267 | :properties
|
266 | 268 | {"street" {:type "string"}
|
267 |
| - "city" {:oneOf [{:enum [:tre :hki] :type "string"} |
| 269 | + "city" {:description "a city" |
| 270 | + :oneOf [{:enum [:tre :hki] :type "string"} |
268 | 271 | {:type "null"}]}}
|
269 | 272 | :required ["street" "city"]
|
270 | 273 | :additionalProperties false
|
|
298 | 301 | :schema {:type "integer" :format "int32"}}
|
299 | 302 | {:name "city"
|
300 | 303 | :in "query"
|
301 |
| - :description "" |
| 304 | + :description "a city" |
302 | 305 | :required true
|
303 |
| - :schema |
304 |
| - {:oneOf [{:enum [:tre :hki] :type "string"} {:type "null"}]}} |
| 306 | + :schema {:description "a city" |
| 307 | + :oneOf [{:enum [:tre :hki] :type "string"} {:type "null"}]}} |
305 | 308 | {:name "name"
|
306 | 309 | :in "query"
|
307 | 310 | :description ""
|
|
324 | 327 | :schema {:type "string"}}
|
325 | 328 | {:name "city"
|
326 | 329 | :in "cookie"
|
327 |
| - :description "" |
| 330 | + :description "a city" |
328 | 331 | :required true
|
329 |
| - :schema |
330 |
| - {:oneOf [{:enum [:tre :hki] :type "string"} {:type "null"}]}}]} |
| 332 | + :schema {:description "a city" |
| 333 | + :oneOf [{:enum [:tre :hki] :type "string"} {:type "null"}]}}]} |
331 | 334 | (openapi/openapi-spec
|
332 | 335 | {:parameters
|
333 | 336 | [{:name "name"
|
|
365 | 368 | "address" {:type "object"
|
366 | 369 | :properties
|
367 | 370 | {"street" {:type "string"},
|
368 |
| - "city" {:oneOf [{:enum [:tre :hki] :type "string"} |
| 371 | + "city" {:description "a city" |
| 372 | + :oneOf [{:enum [:tre :hki] :type "string"} |
369 | 373 | {:type "null"}]}}
|
370 | 374 | :required ["street" "city"]
|
371 | 375 | :additionalProperties false
|
|
377 | 381 | {:type "object"
|
378 | 382 | :properties
|
379 | 383 | {"street" {:type "string"}
|
380 |
| - "city" {:oneOf [{:enum [:tre :hki] :type "string"} |
| 384 | + "city" {:description "a city" |
| 385 | + :oneOf [{:enum [:tre :hki] :type "string"} |
381 | 386 | {:type "null"}]}}
|
382 | 387 | :required ["street" "city"]
|
383 | 388 | :additionalProperties false
|
|
427 | 432 | :properties
|
428 | 433 | {"street" {:type "string"}
|
429 | 434 | "city"
|
430 |
| - {:oneOf [{:enum [:tre :hki] :type "string"} |
| 435 | + {:description "a city" |
| 436 | + :oneOf [{:enum [:tre :hki] :type "string"} |
431 | 437 | {:type "null"}]}}
|
432 | 438 | :required ["street" "city"]
|
433 | 439 | :additionalProperties false
|
|
441 | 447 | :properties
|
442 | 448 | {"street" {:type "string"}
|
443 | 449 | "city"
|
444 |
| - {:oneOf [{:enum [:tre :hki] :type "string"} |
| 450 | + {:description "a city" |
| 451 | + :oneOf [{:enum [:tre :hki] :type "string"} |
445 | 452 | {:type "null"}]}}
|
446 | 453 | :required ["street" "city"]
|
447 | 454 | :additionalProperties false
|
|
481 | 488 | :properties
|
482 | 489 | {"street" {:type "string"}
|
483 | 490 | "city"
|
484 |
| - {:oneOf [{:enum [:tre :hki] :type "string"} |
| 491 | + {:description "a city" |
| 492 | + :oneOf [{:enum [:tre :hki] :type "string"} |
485 | 493 | {:type "null"}]}}
|
486 | 494 | :required ["street" "city"]
|
487 | 495 | :additionalProperties false
|
|
516 | 524 | {:description "The number of allowed requests in the current period",
|
517 | 525 | :schema {:type "integer"}},
|
518 | 526 | :City
|
519 |
| - {:description "", |
| 527 | + {:description "a city", |
520 | 528 | :required false,
|
521 | 529 | :schema
|
522 | 530 | {:enum [:tre :hki] :type "string"}}
|
|
537 | 545 | :properties
|
538 | 546 | {"street" {:type "string"}
|
539 | 547 | "city"
|
540 |
| - {:oneOf [{:enum [:tre :hki] :type "string"} |
| 548 | + {:description "a city" |
| 549 | + :oneOf [{:enum [:tre :hki] :type "string"} |
541 | 550 | {:type "null"}]}}
|
542 | 551 | :required ["street" "city"]
|
543 | 552 | :additionalProperties false
|
|
626 | 635 | :openapi/format "password"
|
627 | 636 | :openapi/random-value "42"})
|
628 | 637 | nil))))
|
| 638 | + |
| 639 | +(deftest description-test |
| 640 | + (is (= [{:name "string" |
| 641 | + :in :query |
| 642 | + :description "xyz" |
| 643 | + :required true |
| 644 | + :schema {:type "string" :description "xyz"}}] |
| 645 | + (openapi/extract-parameter :query (st/schema s/Str {:openapi/description "xyz"})))) |
| 646 | + (is (= [{:name "string" |
| 647 | + :in :query |
| 648 | + :description "xyz" |
| 649 | + :required true |
| 650 | + :schema {:type "string" :description "xyz"}}] |
| 651 | + (openapi/extract-parameter :query (st/schema s/Str {:description "xyz"})))) |
| 652 | + (is (= [{:name "a" |
| 653 | + :in "query" |
| 654 | + :description "xyz" |
| 655 | + :required true |
| 656 | + :schema {:type "string" :description "xyz"}} |
| 657 | + {:name "b" |
| 658 | + :in "query" |
| 659 | + :description "abc" |
| 660 | + :required true |
| 661 | + :schema {:type "string" :description "abc"}}] |
| 662 | + (openapi/extract-parameter :query {:a (st/schema s/Str {:openapi/description "xyz"}) |
| 663 | + :b (st/schema s/Str {:description "abc"})})))) |
0 commit comments