Coverage for tests/test_application.py: 100%

34 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1import pytest 1abcde

2from dirty_equals import IsDict 1abcde

3from fastapi.testclient import TestClient 1abcde

4 

5from .main import app 1abcde

6 

7client = TestClient(app) 1abcde

8 

9 

10@pytest.mark.parametrize( 1abcde

11 "path,expected_status,expected_response", 

12 [ 

13 ("/api_route", 200, {"message": "Hello World"}), 

14 ("/non_decorated_route", 200, {"message": "Hello World"}), 

15 ("/nonexistent", 404, {"detail": "Not Found"}), 

16 ], 

17) 

18def test_get_path(path, expected_status, expected_response): 1abcde

19 response = client.get(path) 1abcde

20 assert response.status_code == expected_status 1abcde

21 assert response.json() == expected_response 1abcde

22 

23 

24def test_swagger_ui(): 1abcde

25 response = client.get("/docs") 1abcde

26 assert response.status_code == 200, response.text 1abcde

27 assert response.headers["content-type"] == "text/html; charset=utf-8" 1abcde

28 assert "swagger-ui-dist" in response.text 1abcde

29 assert ( 1abcde

30 "oauth2RedirectUrl: window.location.origin + '/docs/oauth2-redirect'" 

31 in response.text 

32 ) 

33 

34 

35def test_swagger_ui_oauth2_redirect(): 1abcde

36 response = client.get("/docs/oauth2-redirect") 1abcde

37 assert response.status_code == 200, response.text 1abcde

38 assert response.headers["content-type"] == "text/html; charset=utf-8" 1abcde

39 assert "window.opener.swaggerUIRedirectOauth2" in response.text 1abcde

40 

41 

42def test_redoc(): 1abcde

43 response = client.get("/redoc") 1abcde

44 assert response.status_code == 200, response.text 1abcde

45 assert response.headers["content-type"] == "text/html; charset=utf-8" 1abcde

46 assert "redoc@next" in response.text 1abcde

47 

48 

49def test_enum_status_code_response(): 1abcde

50 response = client.get("/enum-status-code") 1abcde

51 assert response.status_code == 201, response.text 1abcde

52 assert response.json() == "foo bar" 1abcde

53 

54 

55def test_openapi_schema(): 1abcde

56 response = client.get("/openapi.json") 1abcde

57 assert response.status_code == 200, response.text 1abcde

58 assert response.json() == { 1abcde

59 "openapi": "3.1.0", 

60 "info": {"title": "FastAPI", "version": "0.1.0"}, 

61 "paths": { 

62 "/api_route": { 

63 "get": { 

64 "responses": { 

65 "200": { 

66 "description": "Successful Response", 

67 "content": {"application/json": {"schema": {}}}, 

68 } 

69 }, 

70 "summary": "Non Operation", 

71 "operationId": "non_operation_api_route_get", 

72 } 

73 }, 

74 "/non_decorated_route": { 

75 "get": { 

76 "responses": { 

77 "200": { 

78 "description": "Successful Response", 

79 "content": {"application/json": {"schema": {}}}, 

80 } 

81 }, 

82 "summary": "Non Decorated Route", 

83 "operationId": "non_decorated_route_non_decorated_route_get", 

84 } 

85 }, 

86 "/text": { 

87 "get": { 

88 "responses": { 

89 "200": { 

90 "description": "Successful Response", 

91 "content": {"application/json": {"schema": {}}}, 

92 } 

93 }, 

94 "summary": "Get Text", 

95 "operationId": "get_text_text_get", 

96 } 

97 }, 

98 "/path/{item_id}": { 

99 "get": { 

100 "responses": { 

101 "200": { 

102 "description": "Successful Response", 

103 "content": {"application/json": {"schema": {}}}, 

104 }, 

105 "422": { 

106 "description": "Validation Error", 

107 "content": { 

108 "application/json": { 

109 "schema": { 

110 "$ref": "#/components/schemas/HTTPValidationError" 

111 } 

112 } 

113 }, 

114 }, 

115 }, 

116 "summary": "Get Id", 

117 "operationId": "get_id_path__item_id__get", 

118 "parameters": [ 

119 { 

120 "required": True, 

121 "schema": {"title": "Item Id"}, 

122 "name": "item_id", 

123 "in": "path", 

124 } 

125 ], 

126 } 

127 }, 

128 "/path/str/{item_id}": { 

129 "get": { 

130 "responses": { 

131 "200": { 

132 "description": "Successful Response", 

133 "content": {"application/json": {"schema": {}}}, 

134 }, 

135 "422": { 

136 "description": "Validation Error", 

137 "content": { 

138 "application/json": { 

139 "schema": { 

140 "$ref": "#/components/schemas/HTTPValidationError" 

141 } 

142 } 

143 }, 

144 }, 

145 }, 

146 "summary": "Get Str Id", 

147 "operationId": "get_str_id_path_str__item_id__get", 

148 "parameters": [ 

149 { 

150 "required": True, 

151 "schema": {"title": "Item Id", "type": "string"}, 

152 "name": "item_id", 

153 "in": "path", 

154 } 

155 ], 

156 } 

157 }, 

158 "/path/int/{item_id}": { 

159 "get": { 

160 "responses": { 

161 "200": { 

162 "description": "Successful Response", 

163 "content": {"application/json": {"schema": {}}}, 

164 }, 

165 "422": { 

166 "description": "Validation Error", 

167 "content": { 

168 "application/json": { 

169 "schema": { 

170 "$ref": "#/components/schemas/HTTPValidationError" 

171 } 

172 } 

173 }, 

174 }, 

175 }, 

176 "summary": "Get Int Id", 

177 "operationId": "get_int_id_path_int__item_id__get", 

178 "parameters": [ 

179 { 

180 "required": True, 

181 "schema": {"title": "Item Id", "type": "integer"}, 

182 "name": "item_id", 

183 "in": "path", 

184 } 

185 ], 

186 } 

187 }, 

188 "/path/float/{item_id}": { 

189 "get": { 

190 "responses": { 

191 "200": { 

192 "description": "Successful Response", 

193 "content": {"application/json": {"schema": {}}}, 

194 }, 

195 "422": { 

196 "description": "Validation Error", 

197 "content": { 

198 "application/json": { 

199 "schema": { 

200 "$ref": "#/components/schemas/HTTPValidationError" 

201 } 

202 } 

203 }, 

204 }, 

205 }, 

206 "summary": "Get Float Id", 

207 "operationId": "get_float_id_path_float__item_id__get", 

208 "parameters": [ 

209 { 

210 "required": True, 

211 "schema": {"title": "Item Id", "type": "number"}, 

212 "name": "item_id", 

213 "in": "path", 

214 } 

215 ], 

216 } 

217 }, 

218 "/path/bool/{item_id}": { 

219 "get": { 

220 "responses": { 

221 "200": { 

222 "description": "Successful Response", 

223 "content": {"application/json": {"schema": {}}}, 

224 }, 

225 "422": { 

226 "description": "Validation Error", 

227 "content": { 

228 "application/json": { 

229 "schema": { 

230 "$ref": "#/components/schemas/HTTPValidationError" 

231 } 

232 } 

233 }, 

234 }, 

235 }, 

236 "summary": "Get Bool Id", 

237 "operationId": "get_bool_id_path_bool__item_id__get", 

238 "parameters": [ 

239 { 

240 "required": True, 

241 "schema": {"title": "Item Id", "type": "boolean"}, 

242 "name": "item_id", 

243 "in": "path", 

244 } 

245 ], 

246 } 

247 }, 

248 "/path/param/{item_id}": { 

249 "get": { 

250 "responses": { 

251 "200": { 

252 "description": "Successful Response", 

253 "content": {"application/json": {"schema": {}}}, 

254 }, 

255 "422": { 

256 "description": "Validation Error", 

257 "content": { 

258 "application/json": { 

259 "schema": { 

260 "$ref": "#/components/schemas/HTTPValidationError" 

261 } 

262 } 

263 }, 

264 }, 

265 }, 

266 "summary": "Get Path Param Id", 

267 "operationId": "get_path_param_id_path_param__item_id__get", 

268 "parameters": [ 

269 { 

270 "name": "item_id", 

271 "in": "path", 

272 "required": True, 

273 "schema": IsDict( 

274 { 

275 "anyOf": [{"type": "string"}, {"type": "null"}], 

276 "title": "Item Id", 

277 } 

278 ) 

279 # TODO: remove when deprecating Pydantic v1 

280 | IsDict({"title": "Item Id", "type": "string"}), 

281 } 

282 ], 

283 } 

284 }, 

285 "/path/param-minlength/{item_id}": { 

286 "get": { 

287 "responses": { 

288 "200": { 

289 "description": "Successful Response", 

290 "content": {"application/json": {"schema": {}}}, 

291 }, 

292 "422": { 

293 "description": "Validation Error", 

294 "content": { 

295 "application/json": { 

296 "schema": { 

297 "$ref": "#/components/schemas/HTTPValidationError" 

298 } 

299 } 

300 }, 

301 }, 

302 }, 

303 "summary": "Get Path Param Min Length", 

304 "operationId": "get_path_param_min_length_path_param_minlength__item_id__get", 

305 "parameters": [ 

306 { 

307 "required": True, 

308 "schema": { 

309 "title": "Item Id", 

310 "minLength": 3, 

311 "type": "string", 

312 }, 

313 "name": "item_id", 

314 "in": "path", 

315 } 

316 ], 

317 } 

318 }, 

319 "/path/param-maxlength/{item_id}": { 

320 "get": { 

321 "responses": { 

322 "200": { 

323 "description": "Successful Response", 

324 "content": {"application/json": {"schema": {}}}, 

325 }, 

326 "422": { 

327 "description": "Validation Error", 

328 "content": { 

329 "application/json": { 

330 "schema": { 

331 "$ref": "#/components/schemas/HTTPValidationError" 

332 } 

333 } 

334 }, 

335 }, 

336 }, 

337 "summary": "Get Path Param Max Length", 

338 "operationId": "get_path_param_max_length_path_param_maxlength__item_id__get", 

339 "parameters": [ 

340 { 

341 "required": True, 

342 "schema": { 

343 "title": "Item Id", 

344 "maxLength": 3, 

345 "type": "string", 

346 }, 

347 "name": "item_id", 

348 "in": "path", 

349 } 

350 ], 

351 } 

352 }, 

353 "/path/param-min_maxlength/{item_id}": { 

354 "get": { 

355 "responses": { 

356 "200": { 

357 "description": "Successful Response", 

358 "content": {"application/json": {"schema": {}}}, 

359 }, 

360 "422": { 

361 "description": "Validation Error", 

362 "content": { 

363 "application/json": { 

364 "schema": { 

365 "$ref": "#/components/schemas/HTTPValidationError" 

366 } 

367 } 

368 }, 

369 }, 

370 }, 

371 "summary": "Get Path Param Min Max Length", 

372 "operationId": "get_path_param_min_max_length_path_param_min_maxlength__item_id__get", 

373 "parameters": [ 

374 { 

375 "required": True, 

376 "schema": { 

377 "title": "Item Id", 

378 "maxLength": 3, 

379 "minLength": 2, 

380 "type": "string", 

381 }, 

382 "name": "item_id", 

383 "in": "path", 

384 } 

385 ], 

386 } 

387 }, 

388 "/path/param-gt/{item_id}": { 

389 "get": { 

390 "responses": { 

391 "200": { 

392 "description": "Successful Response", 

393 "content": {"application/json": {"schema": {}}}, 

394 }, 

395 "422": { 

396 "description": "Validation Error", 

397 "content": { 

398 "application/json": { 

399 "schema": { 

400 "$ref": "#/components/schemas/HTTPValidationError" 

401 } 

402 } 

403 }, 

404 }, 

405 }, 

406 "summary": "Get Path Param Gt", 

407 "operationId": "get_path_param_gt_path_param_gt__item_id__get", 

408 "parameters": [ 

409 { 

410 "required": True, 

411 "schema": { 

412 "title": "Item Id", 

413 "exclusiveMinimum": 3.0, 

414 "type": "number", 

415 }, 

416 "name": "item_id", 

417 "in": "path", 

418 } 

419 ], 

420 } 

421 }, 

422 "/path/param-gt0/{item_id}": { 

423 "get": { 

424 "responses": { 

425 "200": { 

426 "description": "Successful Response", 

427 "content": {"application/json": {"schema": {}}}, 

428 }, 

429 "422": { 

430 "description": "Validation Error", 

431 "content": { 

432 "application/json": { 

433 "schema": { 

434 "$ref": "#/components/schemas/HTTPValidationError" 

435 } 

436 } 

437 }, 

438 }, 

439 }, 

440 "summary": "Get Path Param Gt0", 

441 "operationId": "get_path_param_gt0_path_param_gt0__item_id__get", 

442 "parameters": [ 

443 { 

444 "required": True, 

445 "schema": { 

446 "title": "Item Id", 

447 "exclusiveMinimum": 0.0, 

448 "type": "number", 

449 }, 

450 "name": "item_id", 

451 "in": "path", 

452 } 

453 ], 

454 } 

455 }, 

456 "/path/param-ge/{item_id}": { 

457 "get": { 

458 "responses": { 

459 "200": { 

460 "description": "Successful Response", 

461 "content": {"application/json": {"schema": {}}}, 

462 }, 

463 "422": { 

464 "description": "Validation Error", 

465 "content": { 

466 "application/json": { 

467 "schema": { 

468 "$ref": "#/components/schemas/HTTPValidationError" 

469 } 

470 } 

471 }, 

472 }, 

473 }, 

474 "summary": "Get Path Param Ge", 

475 "operationId": "get_path_param_ge_path_param_ge__item_id__get", 

476 "parameters": [ 

477 { 

478 "required": True, 

479 "schema": { 

480 "title": "Item Id", 

481 "minimum": 3.0, 

482 "type": "number", 

483 }, 

484 "name": "item_id", 

485 "in": "path", 

486 } 

487 ], 

488 } 

489 }, 

490 "/path/param-lt/{item_id}": { 

491 "get": { 

492 "responses": { 

493 "200": { 

494 "description": "Successful Response", 

495 "content": {"application/json": {"schema": {}}}, 

496 }, 

497 "422": { 

498 "description": "Validation Error", 

499 "content": { 

500 "application/json": { 

501 "schema": { 

502 "$ref": "#/components/schemas/HTTPValidationError" 

503 } 

504 } 

505 }, 

506 }, 

507 }, 

508 "summary": "Get Path Param Lt", 

509 "operationId": "get_path_param_lt_path_param_lt__item_id__get", 

510 "parameters": [ 

511 { 

512 "required": True, 

513 "schema": { 

514 "title": "Item Id", 

515 "exclusiveMaximum": 3.0, 

516 "type": "number", 

517 }, 

518 "name": "item_id", 

519 "in": "path", 

520 } 

521 ], 

522 } 

523 }, 

524 "/path/param-lt0/{item_id}": { 

525 "get": { 

526 "responses": { 

527 "200": { 

528 "description": "Successful Response", 

529 "content": {"application/json": {"schema": {}}}, 

530 }, 

531 "422": { 

532 "description": "Validation Error", 

533 "content": { 

534 "application/json": { 

535 "schema": { 

536 "$ref": "#/components/schemas/HTTPValidationError" 

537 } 

538 } 

539 }, 

540 }, 

541 }, 

542 "summary": "Get Path Param Lt0", 

543 "operationId": "get_path_param_lt0_path_param_lt0__item_id__get", 

544 "parameters": [ 

545 { 

546 "required": True, 

547 "schema": { 

548 "title": "Item Id", 

549 "exclusiveMaximum": 0.0, 

550 "type": "number", 

551 }, 

552 "name": "item_id", 

553 "in": "path", 

554 } 

555 ], 

556 } 

557 }, 

558 "/path/param-le/{item_id}": { 

559 "get": { 

560 "responses": { 

561 "200": { 

562 "description": "Successful Response", 

563 "content": {"application/json": {"schema": {}}}, 

564 }, 

565 "422": { 

566 "description": "Validation Error", 

567 "content": { 

568 "application/json": { 

569 "schema": { 

570 "$ref": "#/components/schemas/HTTPValidationError" 

571 } 

572 } 

573 }, 

574 }, 

575 }, 

576 "summary": "Get Path Param Le", 

577 "operationId": "get_path_param_le_path_param_le__item_id__get", 

578 "parameters": [ 

579 { 

580 "required": True, 

581 "schema": { 

582 "title": "Item Id", 

583 "maximum": 3.0, 

584 "type": "number", 

585 }, 

586 "name": "item_id", 

587 "in": "path", 

588 } 

589 ], 

590 } 

591 }, 

592 "/path/param-lt-gt/{item_id}": { 

593 "get": { 

594 "responses": { 

595 "200": { 

596 "description": "Successful Response", 

597 "content": {"application/json": {"schema": {}}}, 

598 }, 

599 "422": { 

600 "description": "Validation Error", 

601 "content": { 

602 "application/json": { 

603 "schema": { 

604 "$ref": "#/components/schemas/HTTPValidationError" 

605 } 

606 } 

607 }, 

608 }, 

609 }, 

610 "summary": "Get Path Param Lt Gt", 

611 "operationId": "get_path_param_lt_gt_path_param_lt_gt__item_id__get", 

612 "parameters": [ 

613 { 

614 "required": True, 

615 "schema": { 

616 "title": "Item Id", 

617 "exclusiveMaximum": 3.0, 

618 "exclusiveMinimum": 1.0, 

619 "type": "number", 

620 }, 

621 "name": "item_id", 

622 "in": "path", 

623 } 

624 ], 

625 } 

626 }, 

627 "/path/param-le-ge/{item_id}": { 

628 "get": { 

629 "responses": { 

630 "200": { 

631 "description": "Successful Response", 

632 "content": {"application/json": {"schema": {}}}, 

633 }, 

634 "422": { 

635 "description": "Validation Error", 

636 "content": { 

637 "application/json": { 

638 "schema": { 

639 "$ref": "#/components/schemas/HTTPValidationError" 

640 } 

641 } 

642 }, 

643 }, 

644 }, 

645 "summary": "Get Path Param Le Ge", 

646 "operationId": "get_path_param_le_ge_path_param_le_ge__item_id__get", 

647 "parameters": [ 

648 { 

649 "required": True, 

650 "schema": { 

651 "title": "Item Id", 

652 "maximum": 3.0, 

653 "minimum": 1.0, 

654 "type": "number", 

655 }, 

656 "name": "item_id", 

657 "in": "path", 

658 } 

659 ], 

660 } 

661 }, 

662 "/path/param-lt-int/{item_id}": { 

663 "get": { 

664 "responses": { 

665 "200": { 

666 "description": "Successful Response", 

667 "content": {"application/json": {"schema": {}}}, 

668 }, 

669 "422": { 

670 "description": "Validation Error", 

671 "content": { 

672 "application/json": { 

673 "schema": { 

674 "$ref": "#/components/schemas/HTTPValidationError" 

675 } 

676 } 

677 }, 

678 }, 

679 }, 

680 "summary": "Get Path Param Lt Int", 

681 "operationId": "get_path_param_lt_int_path_param_lt_int__item_id__get", 

682 "parameters": [ 

683 { 

684 "required": True, 

685 "schema": { 

686 "title": "Item Id", 

687 "exclusiveMaximum": 3.0, 

688 "type": "integer", 

689 }, 

690 "name": "item_id", 

691 "in": "path", 

692 } 

693 ], 

694 } 

695 }, 

696 "/path/param-gt-int/{item_id}": { 

697 "get": { 

698 "responses": { 

699 "200": { 

700 "description": "Successful Response", 

701 "content": {"application/json": {"schema": {}}}, 

702 }, 

703 "422": { 

704 "description": "Validation Error", 

705 "content": { 

706 "application/json": { 

707 "schema": { 

708 "$ref": "#/components/schemas/HTTPValidationError" 

709 } 

710 } 

711 }, 

712 }, 

713 }, 

714 "summary": "Get Path Param Gt Int", 

715 "operationId": "get_path_param_gt_int_path_param_gt_int__item_id__get", 

716 "parameters": [ 

717 { 

718 "required": True, 

719 "schema": { 

720 "title": "Item Id", 

721 "exclusiveMinimum": 3.0, 

722 "type": "integer", 

723 }, 

724 "name": "item_id", 

725 "in": "path", 

726 } 

727 ], 

728 } 

729 }, 

730 "/path/param-le-int/{item_id}": { 

731 "get": { 

732 "responses": { 

733 "200": { 

734 "description": "Successful Response", 

735 "content": {"application/json": {"schema": {}}}, 

736 }, 

737 "422": { 

738 "description": "Validation Error", 

739 "content": { 

740 "application/json": { 

741 "schema": { 

742 "$ref": "#/components/schemas/HTTPValidationError" 

743 } 

744 } 

745 }, 

746 }, 

747 }, 

748 "summary": "Get Path Param Le Int", 

749 "operationId": "get_path_param_le_int_path_param_le_int__item_id__get", 

750 "parameters": [ 

751 { 

752 "required": True, 

753 "schema": { 

754 "title": "Item Id", 

755 "maximum": 3.0, 

756 "type": "integer", 

757 }, 

758 "name": "item_id", 

759 "in": "path", 

760 } 

761 ], 

762 } 

763 }, 

764 "/path/param-ge-int/{item_id}": { 

765 "get": { 

766 "responses": { 

767 "200": { 

768 "description": "Successful Response", 

769 "content": {"application/json": {"schema": {}}}, 

770 }, 

771 "422": { 

772 "description": "Validation Error", 

773 "content": { 

774 "application/json": { 

775 "schema": { 

776 "$ref": "#/components/schemas/HTTPValidationError" 

777 } 

778 } 

779 }, 

780 }, 

781 }, 

782 "summary": "Get Path Param Ge Int", 

783 "operationId": "get_path_param_ge_int_path_param_ge_int__item_id__get", 

784 "parameters": [ 

785 { 

786 "required": True, 

787 "schema": { 

788 "title": "Item Id", 

789 "minimum": 3.0, 

790 "type": "integer", 

791 }, 

792 "name": "item_id", 

793 "in": "path", 

794 } 

795 ], 

796 } 

797 }, 

798 "/path/param-lt-gt-int/{item_id}": { 

799 "get": { 

800 "responses": { 

801 "200": { 

802 "description": "Successful Response", 

803 "content": {"application/json": {"schema": {}}}, 

804 }, 

805 "422": { 

806 "description": "Validation Error", 

807 "content": { 

808 "application/json": { 

809 "schema": { 

810 "$ref": "#/components/schemas/HTTPValidationError" 

811 } 

812 } 

813 }, 

814 }, 

815 }, 

816 "summary": "Get Path Param Lt Gt Int", 

817 "operationId": "get_path_param_lt_gt_int_path_param_lt_gt_int__item_id__get", 

818 "parameters": [ 

819 { 

820 "required": True, 

821 "schema": { 

822 "title": "Item Id", 

823 "exclusiveMaximum": 3.0, 

824 "exclusiveMinimum": 1.0, 

825 "type": "integer", 

826 }, 

827 "name": "item_id", 

828 "in": "path", 

829 } 

830 ], 

831 } 

832 }, 

833 "/path/param-le-ge-int/{item_id}": { 

834 "get": { 

835 "responses": { 

836 "200": { 

837 "description": "Successful Response", 

838 "content": {"application/json": {"schema": {}}}, 

839 }, 

840 "422": { 

841 "description": "Validation Error", 

842 "content": { 

843 "application/json": { 

844 "schema": { 

845 "$ref": "#/components/schemas/HTTPValidationError" 

846 } 

847 } 

848 }, 

849 }, 

850 }, 

851 "summary": "Get Path Param Le Ge Int", 

852 "operationId": "get_path_param_le_ge_int_path_param_le_ge_int__item_id__get", 

853 "parameters": [ 

854 { 

855 "required": True, 

856 "schema": { 

857 "title": "Item Id", 

858 "maximum": 3.0, 

859 "minimum": 1.0, 

860 "type": "integer", 

861 }, 

862 "name": "item_id", 

863 "in": "path", 

864 } 

865 ], 

866 } 

867 }, 

868 "/query": { 

869 "get": { 

870 "responses": { 

871 "200": { 

872 "description": "Successful Response", 

873 "content": {"application/json": {"schema": {}}}, 

874 }, 

875 "422": { 

876 "description": "Validation Error", 

877 "content": { 

878 "application/json": { 

879 "schema": { 

880 "$ref": "#/components/schemas/HTTPValidationError" 

881 } 

882 } 

883 }, 

884 }, 

885 }, 

886 "summary": "Get Query", 

887 "operationId": "get_query_query_get", 

888 "parameters": [ 

889 { 

890 "required": True, 

891 "schema": {"title": "Query"}, 

892 "name": "query", 

893 "in": "query", 

894 } 

895 ], 

896 } 

897 }, 

898 "/query/optional": { 

899 "get": { 

900 "responses": { 

901 "200": { 

902 "description": "Successful Response", 

903 "content": {"application/json": {"schema": {}}}, 

904 }, 

905 "422": { 

906 "description": "Validation Error", 

907 "content": { 

908 "application/json": { 

909 "schema": { 

910 "$ref": "#/components/schemas/HTTPValidationError" 

911 } 

912 } 

913 }, 

914 }, 

915 }, 

916 "summary": "Get Query Optional", 

917 "operationId": "get_query_optional_query_optional_get", 

918 "parameters": [ 

919 { 

920 "required": False, 

921 "schema": {"title": "Query"}, 

922 "name": "query", 

923 "in": "query", 

924 } 

925 ], 

926 } 

927 }, 

928 "/query/int": { 

929 "get": { 

930 "responses": { 

931 "200": { 

932 "description": "Successful Response", 

933 "content": {"application/json": {"schema": {}}}, 

934 }, 

935 "422": { 

936 "description": "Validation Error", 

937 "content": { 

938 "application/json": { 

939 "schema": { 

940 "$ref": "#/components/schemas/HTTPValidationError" 

941 } 

942 } 

943 }, 

944 }, 

945 }, 

946 "summary": "Get Query Type", 

947 "operationId": "get_query_type_query_int_get", 

948 "parameters": [ 

949 { 

950 "required": True, 

951 "schema": {"title": "Query", "type": "integer"}, 

952 "name": "query", 

953 "in": "query", 

954 } 

955 ], 

956 } 

957 }, 

958 "/query/int/optional": { 

959 "get": { 

960 "responses": { 

961 "200": { 

962 "description": "Successful Response", 

963 "content": {"application/json": {"schema": {}}}, 

964 }, 

965 "422": { 

966 "description": "Validation Error", 

967 "content": { 

968 "application/json": { 

969 "schema": { 

970 "$ref": "#/components/schemas/HTTPValidationError" 

971 } 

972 } 

973 }, 

974 }, 

975 }, 

976 "summary": "Get Query Type Optional", 

977 "operationId": "get_query_type_optional_query_int_optional_get", 

978 "parameters": [ 

979 { 

980 "name": "query", 

981 "in": "query", 

982 "required": False, 

983 "schema": IsDict( 

984 { 

985 "anyOf": [{"type": "integer"}, {"type": "null"}], 

986 "title": "Query", 

987 } 

988 ) 

989 # TODO: remove when deprecating Pydantic v1 

990 | IsDict({"title": "Query", "type": "integer"}), 

991 } 

992 ], 

993 } 

994 }, 

995 "/query/int/default": { 

996 "get": { 

997 "responses": { 

998 "200": { 

999 "description": "Successful Response", 

1000 "content": {"application/json": {"schema": {}}}, 

1001 }, 

1002 "422": { 

1003 "description": "Validation Error", 

1004 "content": { 

1005 "application/json": { 

1006 "schema": { 

1007 "$ref": "#/components/schemas/HTTPValidationError" 

1008 } 

1009 } 

1010 }, 

1011 }, 

1012 }, 

1013 "summary": "Get Query Type Int Default", 

1014 "operationId": "get_query_type_int_default_query_int_default_get", 

1015 "parameters": [ 

1016 { 

1017 "required": False, 

1018 "schema": { 

1019 "title": "Query", 

1020 "type": "integer", 

1021 "default": 10, 

1022 }, 

1023 "name": "query", 

1024 "in": "query", 

1025 } 

1026 ], 

1027 } 

1028 }, 

1029 "/query/param": { 

1030 "get": { 

1031 "responses": { 

1032 "200": { 

1033 "description": "Successful Response", 

1034 "content": {"application/json": {"schema": {}}}, 

1035 }, 

1036 "422": { 

1037 "description": "Validation Error", 

1038 "content": { 

1039 "application/json": { 

1040 "schema": { 

1041 "$ref": "#/components/schemas/HTTPValidationError" 

1042 } 

1043 } 

1044 }, 

1045 }, 

1046 }, 

1047 "summary": "Get Query Param", 

1048 "operationId": "get_query_param_query_param_get", 

1049 "parameters": [ 

1050 { 

1051 "required": False, 

1052 "schema": {"title": "Query"}, 

1053 "name": "query", 

1054 "in": "query", 

1055 } 

1056 ], 

1057 } 

1058 }, 

1059 "/query/param-required": { 

1060 "get": { 

1061 "responses": { 

1062 "200": { 

1063 "description": "Successful Response", 

1064 "content": {"application/json": {"schema": {}}}, 

1065 }, 

1066 "422": { 

1067 "description": "Validation Error", 

1068 "content": { 

1069 "application/json": { 

1070 "schema": { 

1071 "$ref": "#/components/schemas/HTTPValidationError" 

1072 } 

1073 } 

1074 }, 

1075 }, 

1076 }, 

1077 "summary": "Get Query Param Required", 

1078 "operationId": "get_query_param_required_query_param_required_get", 

1079 "parameters": [ 

1080 { 

1081 "required": True, 

1082 "schema": {"title": "Query"}, 

1083 "name": "query", 

1084 "in": "query", 

1085 } 

1086 ], 

1087 } 

1088 }, 

1089 "/query/param-required/int": { 

1090 "get": { 

1091 "responses": { 

1092 "200": { 

1093 "description": "Successful Response", 

1094 "content": {"application/json": {"schema": {}}}, 

1095 }, 

1096 "422": { 

1097 "description": "Validation Error", 

1098 "content": { 

1099 "application/json": { 

1100 "schema": { 

1101 "$ref": "#/components/schemas/HTTPValidationError" 

1102 } 

1103 } 

1104 }, 

1105 }, 

1106 }, 

1107 "summary": "Get Query Param Required Type", 

1108 "operationId": "get_query_param_required_type_query_param_required_int_get", 

1109 "parameters": [ 

1110 { 

1111 "required": True, 

1112 "schema": {"title": "Query", "type": "integer"}, 

1113 "name": "query", 

1114 "in": "query", 

1115 } 

1116 ], 

1117 } 

1118 }, 

1119 "/enum-status-code": { 

1120 "get": { 

1121 "responses": { 

1122 "201": { 

1123 "description": "Successful Response", 

1124 "content": {"application/json": {"schema": {}}}, 

1125 }, 

1126 }, 

1127 "summary": "Get Enum Status Code", 

1128 "operationId": "get_enum_status_code_enum_status_code_get", 

1129 } 

1130 }, 

1131 "/query/frozenset": { 

1132 "get": { 

1133 "summary": "Get Query Type Frozenset", 

1134 "operationId": "get_query_type_frozenset_query_frozenset_get", 

1135 "parameters": [ 

1136 { 

1137 "required": True, 

1138 "schema": { 

1139 "title": "Query", 

1140 "uniqueItems": True, 

1141 "type": "array", 

1142 "items": {"type": "integer"}, 

1143 }, 

1144 "name": "query", 

1145 "in": "query", 

1146 } 

1147 ], 

1148 "responses": { 

1149 "200": { 

1150 "description": "Successful Response", 

1151 "content": {"application/json": {"schema": {}}}, 

1152 }, 

1153 "422": { 

1154 "description": "Validation Error", 

1155 "content": { 

1156 "application/json": { 

1157 "schema": { 

1158 "$ref": "#/components/schemas/HTTPValidationError" 

1159 } 

1160 } 

1161 }, 

1162 }, 

1163 }, 

1164 } 

1165 }, 

1166 "/query/list": { 

1167 "get": { 

1168 "summary": "Get Query List", 

1169 "operationId": "get_query_list_query_list_get", 

1170 "parameters": [ 

1171 { 

1172 "name": "device_ids", 

1173 "in": "query", 

1174 "required": True, 

1175 "schema": { 

1176 "type": "array", 

1177 "items": {"type": "integer"}, 

1178 "title": "Device Ids", 

1179 }, 

1180 } 

1181 ], 

1182 "responses": { 

1183 "200": { 

1184 "description": "Successful Response", 

1185 "content": { 

1186 "application/json": { 

1187 "schema": { 

1188 "type": "array", 

1189 "items": {"type": "integer"}, 

1190 "title": "Response Get Query List Query List Get", 

1191 } 

1192 } 

1193 }, 

1194 }, 

1195 "422": { 

1196 "description": "Validation Error", 

1197 "content": { 

1198 "application/json": { 

1199 "schema": { 

1200 "$ref": "#/components/schemas/HTTPValidationError" 

1201 } 

1202 } 

1203 }, 

1204 }, 

1205 }, 

1206 } 

1207 }, 

1208 "/query/list-default": { 

1209 "get": { 

1210 "summary": "Get Query List Default", 

1211 "operationId": "get_query_list_default_query_list_default_get", 

1212 "parameters": [ 

1213 { 

1214 "name": "device_ids", 

1215 "in": "query", 

1216 "required": False, 

1217 "schema": { 

1218 "type": "array", 

1219 "items": {"type": "integer"}, 

1220 "default": [], 

1221 "title": "Device Ids", 

1222 }, 

1223 } 

1224 ], 

1225 "responses": { 

1226 "200": { 

1227 "description": "Successful Response", 

1228 "content": { 

1229 "application/json": { 

1230 "schema": { 

1231 "type": "array", 

1232 "items": {"type": "integer"}, 

1233 "title": "Response Get Query List Default Query List Default Get", 

1234 } 

1235 } 

1236 }, 

1237 }, 

1238 "422": { 

1239 "description": "Validation Error", 

1240 "content": { 

1241 "application/json": { 

1242 "schema": { 

1243 "$ref": "#/components/schemas/HTTPValidationError" 

1244 } 

1245 } 

1246 }, 

1247 }, 

1248 }, 

1249 } 

1250 }, 

1251 }, 

1252 "components": { 

1253 "schemas": { 

1254 "ValidationError": { 

1255 "title": "ValidationError", 

1256 "required": ["loc", "msg", "type"], 

1257 "type": "object", 

1258 "properties": { 

1259 "loc": { 

1260 "title": "Location", 

1261 "type": "array", 

1262 "items": { 

1263 "anyOf": [{"type": "string"}, {"type": "integer"}] 

1264 }, 

1265 }, 

1266 "msg": {"title": "Message", "type": "string"}, 

1267 "type": {"title": "Error Type", "type": "string"}, 

1268 }, 

1269 }, 

1270 "HTTPValidationError": { 

1271 "title": "HTTPValidationError", 

1272 "type": "object", 

1273 "properties": { 

1274 "detail": { 

1275 "title": "Detail", 

1276 "type": "array", 

1277 "items": {"$ref": "#/components/schemas/ValidationError"}, 

1278 } 

1279 }, 

1280 }, 

1281 } 

1282 }, 

1283 }