Coverage for tests/test_application.py: 100%

34 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-09-22 00:03 +0000

1import pytest 1abcdef

2from dirty_equals import IsDict 1abcdef

3from fastapi.testclient import TestClient 1abcdef

4 

5from .main import app 1abcdef

6 

7client = TestClient(app) 1abcdef

8 

9 

10@pytest.mark.parametrize( 1abcdef

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): 1abcdef

19 response = client.get(path) 1yzABCD

20 assert response.status_code == expected_status 1yzABCD

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

22 

23 

24def test_swagger_ui(): 1abcdef

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

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

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

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

29 assert ( 1ghijkl

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

31 in response.text 

32 ) 

33 

34 

35def test_swagger_ui_oauth2_redirect(): 1abcdef

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

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

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

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

40 

41 

42def test_redoc(): 1abcdef

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

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

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

46 assert "redoc@2" in response.text 1stuvwx

47 

48 

49def test_enum_status_code_response(): 1abcdef

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

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

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

53 

54 

55def test_openapi_schema(): 1abcdef

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

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

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

59 "openapi": "3.1.0", 

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

61 "externalDocs": { 

62 "description": "External API documentation.", 

63 "url": "https://docs.example.com/api-general", 

64 }, 

65 "paths": { 

66 "/api_route": { 

67 "get": { 

68 "responses": { 

69 "200": { 

70 "description": "Successful Response", 

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

72 } 

73 }, 

74 "summary": "Non Operation", 

75 "operationId": "non_operation_api_route_get", 

76 } 

77 }, 

78 "/non_decorated_route": { 

79 "get": { 

80 "responses": { 

81 "200": { 

82 "description": "Successful Response", 

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

84 } 

85 }, 

86 "summary": "Non Decorated Route", 

87 "operationId": "non_decorated_route_non_decorated_route_get", 

88 } 

89 }, 

90 "/text": { 

91 "get": { 

92 "responses": { 

93 "200": { 

94 "description": "Successful Response", 

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

96 } 

97 }, 

98 "summary": "Get Text", 

99 "operationId": "get_text_text_get", 

100 } 

101 }, 

102 "/path/{item_id}": { 

103 "get": { 

104 "responses": { 

105 "200": { 

106 "description": "Successful Response", 

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

108 }, 

109 "422": { 

110 "description": "Validation Error", 

111 "content": { 

112 "application/json": { 

113 "schema": { 

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

115 } 

116 } 

117 }, 

118 }, 

119 }, 

120 "summary": "Get Id", 

121 "operationId": "get_id_path__item_id__get", 

122 "parameters": [ 

123 { 

124 "required": True, 

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

126 "name": "item_id", 

127 "in": "path", 

128 } 

129 ], 

130 } 

131 }, 

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

133 "get": { 

134 "responses": { 

135 "200": { 

136 "description": "Successful Response", 

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

138 }, 

139 "422": { 

140 "description": "Validation Error", 

141 "content": { 

142 "application/json": { 

143 "schema": { 

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

145 } 

146 } 

147 }, 

148 }, 

149 }, 

150 "summary": "Get Str Id", 

151 "operationId": "get_str_id_path_str__item_id__get", 

152 "parameters": [ 

153 { 

154 "required": True, 

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

156 "name": "item_id", 

157 "in": "path", 

158 } 

159 ], 

160 } 

161 }, 

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

163 "get": { 

164 "responses": { 

165 "200": { 

166 "description": "Successful Response", 

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

168 }, 

169 "422": { 

170 "description": "Validation Error", 

171 "content": { 

172 "application/json": { 

173 "schema": { 

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

175 } 

176 } 

177 }, 

178 }, 

179 }, 

180 "summary": "Get Int Id", 

181 "operationId": "get_int_id_path_int__item_id__get", 

182 "parameters": [ 

183 { 

184 "required": True, 

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

186 "name": "item_id", 

187 "in": "path", 

188 } 

189 ], 

190 } 

191 }, 

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

193 "get": { 

194 "responses": { 

195 "200": { 

196 "description": "Successful Response", 

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

198 }, 

199 "422": { 

200 "description": "Validation Error", 

201 "content": { 

202 "application/json": { 

203 "schema": { 

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

205 } 

206 } 

207 }, 

208 }, 

209 }, 

210 "summary": "Get Float Id", 

211 "operationId": "get_float_id_path_float__item_id__get", 

212 "parameters": [ 

213 { 

214 "required": True, 

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

216 "name": "item_id", 

217 "in": "path", 

218 } 

219 ], 

220 } 

221 }, 

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

223 "get": { 

224 "responses": { 

225 "200": { 

226 "description": "Successful Response", 

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

228 }, 

229 "422": { 

230 "description": "Validation Error", 

231 "content": { 

232 "application/json": { 

233 "schema": { 

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

235 } 

236 } 

237 }, 

238 }, 

239 }, 

240 "summary": "Get Bool Id", 

241 "operationId": "get_bool_id_path_bool__item_id__get", 

242 "parameters": [ 

243 { 

244 "required": True, 

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

246 "name": "item_id", 

247 "in": "path", 

248 } 

249 ], 

250 } 

251 }, 

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

253 "get": { 

254 "responses": { 

255 "200": { 

256 "description": "Successful Response", 

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

258 }, 

259 "422": { 

260 "description": "Validation Error", 

261 "content": { 

262 "application/json": { 

263 "schema": { 

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

265 } 

266 } 

267 }, 

268 }, 

269 }, 

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

271 "operationId": "get_path_param_id_path_param__item_id__get", 

272 "parameters": [ 

273 { 

274 "name": "item_id", 

275 "in": "path", 

276 "required": True, 

277 "schema": IsDict( 

278 { 

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

280 "title": "Item Id", 

281 } 

282 ) 

283 # TODO: remove when deprecating Pydantic v1 

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

285 } 

286 ], 

287 } 

288 }, 

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

290 "get": { 

291 "responses": { 

292 "200": { 

293 "description": "Successful Response", 

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

295 }, 

296 "422": { 

297 "description": "Validation Error", 

298 "content": { 

299 "application/json": { 

300 "schema": { 

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

302 } 

303 } 

304 }, 

305 }, 

306 }, 

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

308 "operationId": "get_path_param_min_length_path_param_minlength__item_id__get", 

309 "parameters": [ 

310 { 

311 "required": True, 

312 "schema": { 

313 "title": "Item Id", 

314 "minLength": 3, 

315 "type": "string", 

316 }, 

317 "name": "item_id", 

318 "in": "path", 

319 } 

320 ], 

321 } 

322 }, 

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

324 "get": { 

325 "responses": { 

326 "200": { 

327 "description": "Successful Response", 

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

329 }, 

330 "422": { 

331 "description": "Validation Error", 

332 "content": { 

333 "application/json": { 

334 "schema": { 

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

336 } 

337 } 

338 }, 

339 }, 

340 }, 

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

342 "operationId": "get_path_param_max_length_path_param_maxlength__item_id__get", 

343 "parameters": [ 

344 { 

345 "required": True, 

346 "schema": { 

347 "title": "Item Id", 

348 "maxLength": 3, 

349 "type": "string", 

350 }, 

351 "name": "item_id", 

352 "in": "path", 

353 } 

354 ], 

355 } 

356 }, 

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

358 "get": { 

359 "responses": { 

360 "200": { 

361 "description": "Successful Response", 

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

363 }, 

364 "422": { 

365 "description": "Validation Error", 

366 "content": { 

367 "application/json": { 

368 "schema": { 

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

370 } 

371 } 

372 }, 

373 }, 

374 }, 

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

376 "operationId": "get_path_param_min_max_length_path_param_min_maxlength__item_id__get", 

377 "parameters": [ 

378 { 

379 "required": True, 

380 "schema": { 

381 "title": "Item Id", 

382 "maxLength": 3, 

383 "minLength": 2, 

384 "type": "string", 

385 }, 

386 "name": "item_id", 

387 "in": "path", 

388 } 

389 ], 

390 } 

391 }, 

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

393 "get": { 

394 "responses": { 

395 "200": { 

396 "description": "Successful Response", 

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

398 }, 

399 "422": { 

400 "description": "Validation Error", 

401 "content": { 

402 "application/json": { 

403 "schema": { 

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

405 } 

406 } 

407 }, 

408 }, 

409 }, 

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

411 "operationId": "get_path_param_gt_path_param_gt__item_id__get", 

412 "parameters": [ 

413 { 

414 "required": True, 

415 "schema": { 

416 "title": "Item Id", 

417 "exclusiveMinimum": 3.0, 

418 "type": "number", 

419 }, 

420 "name": "item_id", 

421 "in": "path", 

422 } 

423 ], 

424 } 

425 }, 

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

427 "get": { 

428 "responses": { 

429 "200": { 

430 "description": "Successful Response", 

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

432 }, 

433 "422": { 

434 "description": "Validation Error", 

435 "content": { 

436 "application/json": { 

437 "schema": { 

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

439 } 

440 } 

441 }, 

442 }, 

443 }, 

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

445 "operationId": "get_path_param_gt0_path_param_gt0__item_id__get", 

446 "parameters": [ 

447 { 

448 "required": True, 

449 "schema": { 

450 "title": "Item Id", 

451 "exclusiveMinimum": 0.0, 

452 "type": "number", 

453 }, 

454 "name": "item_id", 

455 "in": "path", 

456 } 

457 ], 

458 } 

459 }, 

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

461 "get": { 

462 "responses": { 

463 "200": { 

464 "description": "Successful Response", 

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

466 }, 

467 "422": { 

468 "description": "Validation Error", 

469 "content": { 

470 "application/json": { 

471 "schema": { 

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

473 } 

474 } 

475 }, 

476 }, 

477 }, 

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

479 "operationId": "get_path_param_ge_path_param_ge__item_id__get", 

480 "parameters": [ 

481 { 

482 "required": True, 

483 "schema": { 

484 "title": "Item Id", 

485 "minimum": 3.0, 

486 "type": "number", 

487 }, 

488 "name": "item_id", 

489 "in": "path", 

490 } 

491 ], 

492 } 

493 }, 

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

495 "get": { 

496 "responses": { 

497 "200": { 

498 "description": "Successful Response", 

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

500 }, 

501 "422": { 

502 "description": "Validation Error", 

503 "content": { 

504 "application/json": { 

505 "schema": { 

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

507 } 

508 } 

509 }, 

510 }, 

511 }, 

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

513 "operationId": "get_path_param_lt_path_param_lt__item_id__get", 

514 "parameters": [ 

515 { 

516 "required": True, 

517 "schema": { 

518 "title": "Item Id", 

519 "exclusiveMaximum": 3.0, 

520 "type": "number", 

521 }, 

522 "name": "item_id", 

523 "in": "path", 

524 } 

525 ], 

526 } 

527 }, 

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

529 "get": { 

530 "responses": { 

531 "200": { 

532 "description": "Successful Response", 

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

534 }, 

535 "422": { 

536 "description": "Validation Error", 

537 "content": { 

538 "application/json": { 

539 "schema": { 

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

541 } 

542 } 

543 }, 

544 }, 

545 }, 

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

547 "operationId": "get_path_param_lt0_path_param_lt0__item_id__get", 

548 "parameters": [ 

549 { 

550 "required": True, 

551 "schema": { 

552 "title": "Item Id", 

553 "exclusiveMaximum": 0.0, 

554 "type": "number", 

555 }, 

556 "name": "item_id", 

557 "in": "path", 

558 } 

559 ], 

560 } 

561 }, 

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

563 "get": { 

564 "responses": { 

565 "200": { 

566 "description": "Successful Response", 

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

568 }, 

569 "422": { 

570 "description": "Validation Error", 

571 "content": { 

572 "application/json": { 

573 "schema": { 

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

575 } 

576 } 

577 }, 

578 }, 

579 }, 

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

581 "operationId": "get_path_param_le_path_param_le__item_id__get", 

582 "parameters": [ 

583 { 

584 "required": True, 

585 "schema": { 

586 "title": "Item Id", 

587 "maximum": 3.0, 

588 "type": "number", 

589 }, 

590 "name": "item_id", 

591 "in": "path", 

592 } 

593 ], 

594 } 

595 }, 

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

597 "get": { 

598 "responses": { 

599 "200": { 

600 "description": "Successful Response", 

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

602 }, 

603 "422": { 

604 "description": "Validation Error", 

605 "content": { 

606 "application/json": { 

607 "schema": { 

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

609 } 

610 } 

611 }, 

612 }, 

613 }, 

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

615 "operationId": "get_path_param_lt_gt_path_param_lt_gt__item_id__get", 

616 "parameters": [ 

617 { 

618 "required": True, 

619 "schema": { 

620 "title": "Item Id", 

621 "exclusiveMaximum": 3.0, 

622 "exclusiveMinimum": 1.0, 

623 "type": "number", 

624 }, 

625 "name": "item_id", 

626 "in": "path", 

627 } 

628 ], 

629 } 

630 }, 

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

632 "get": { 

633 "responses": { 

634 "200": { 

635 "description": "Successful Response", 

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

637 }, 

638 "422": { 

639 "description": "Validation Error", 

640 "content": { 

641 "application/json": { 

642 "schema": { 

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

644 } 

645 } 

646 }, 

647 }, 

648 }, 

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

650 "operationId": "get_path_param_le_ge_path_param_le_ge__item_id__get", 

651 "parameters": [ 

652 { 

653 "required": True, 

654 "schema": { 

655 "title": "Item Id", 

656 "maximum": 3.0, 

657 "minimum": 1.0, 

658 "type": "number", 

659 }, 

660 "name": "item_id", 

661 "in": "path", 

662 } 

663 ], 

664 } 

665 }, 

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

667 "get": { 

668 "responses": { 

669 "200": { 

670 "description": "Successful Response", 

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

672 }, 

673 "422": { 

674 "description": "Validation Error", 

675 "content": { 

676 "application/json": { 

677 "schema": { 

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

679 } 

680 } 

681 }, 

682 }, 

683 }, 

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

685 "operationId": "get_path_param_lt_int_path_param_lt_int__item_id__get", 

686 "parameters": [ 

687 { 

688 "required": True, 

689 "schema": { 

690 "title": "Item Id", 

691 "exclusiveMaximum": 3.0, 

692 "type": "integer", 

693 }, 

694 "name": "item_id", 

695 "in": "path", 

696 } 

697 ], 

698 } 

699 }, 

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

701 "get": { 

702 "responses": { 

703 "200": { 

704 "description": "Successful Response", 

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

706 }, 

707 "422": { 

708 "description": "Validation Error", 

709 "content": { 

710 "application/json": { 

711 "schema": { 

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

713 } 

714 } 

715 }, 

716 }, 

717 }, 

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

719 "operationId": "get_path_param_gt_int_path_param_gt_int__item_id__get", 

720 "parameters": [ 

721 { 

722 "required": True, 

723 "schema": { 

724 "title": "Item Id", 

725 "exclusiveMinimum": 3.0, 

726 "type": "integer", 

727 }, 

728 "name": "item_id", 

729 "in": "path", 

730 } 

731 ], 

732 } 

733 }, 

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

735 "get": { 

736 "responses": { 

737 "200": { 

738 "description": "Successful Response", 

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

740 }, 

741 "422": { 

742 "description": "Validation Error", 

743 "content": { 

744 "application/json": { 

745 "schema": { 

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

747 } 

748 } 

749 }, 

750 }, 

751 }, 

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

753 "operationId": "get_path_param_le_int_path_param_le_int__item_id__get", 

754 "parameters": [ 

755 { 

756 "required": True, 

757 "schema": { 

758 "title": "Item Id", 

759 "maximum": 3.0, 

760 "type": "integer", 

761 }, 

762 "name": "item_id", 

763 "in": "path", 

764 } 

765 ], 

766 } 

767 }, 

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

769 "get": { 

770 "responses": { 

771 "200": { 

772 "description": "Successful Response", 

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

774 }, 

775 "422": { 

776 "description": "Validation Error", 

777 "content": { 

778 "application/json": { 

779 "schema": { 

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

781 } 

782 } 

783 }, 

784 }, 

785 }, 

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

787 "operationId": "get_path_param_ge_int_path_param_ge_int__item_id__get", 

788 "parameters": [ 

789 { 

790 "required": True, 

791 "schema": { 

792 "title": "Item Id", 

793 "minimum": 3.0, 

794 "type": "integer", 

795 }, 

796 "name": "item_id", 

797 "in": "path", 

798 } 

799 ], 

800 } 

801 }, 

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

803 "get": { 

804 "responses": { 

805 "200": { 

806 "description": "Successful Response", 

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

808 }, 

809 "422": { 

810 "description": "Validation Error", 

811 "content": { 

812 "application/json": { 

813 "schema": { 

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

815 } 

816 } 

817 }, 

818 }, 

819 }, 

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

821 "operationId": "get_path_param_lt_gt_int_path_param_lt_gt_int__item_id__get", 

822 "parameters": [ 

823 { 

824 "required": True, 

825 "schema": { 

826 "title": "Item Id", 

827 "exclusiveMaximum": 3.0, 

828 "exclusiveMinimum": 1.0, 

829 "type": "integer", 

830 }, 

831 "name": "item_id", 

832 "in": "path", 

833 } 

834 ], 

835 } 

836 }, 

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

838 "get": { 

839 "responses": { 

840 "200": { 

841 "description": "Successful Response", 

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

843 }, 

844 "422": { 

845 "description": "Validation Error", 

846 "content": { 

847 "application/json": { 

848 "schema": { 

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

850 } 

851 } 

852 }, 

853 }, 

854 }, 

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

856 "operationId": "get_path_param_le_ge_int_path_param_le_ge_int__item_id__get", 

857 "parameters": [ 

858 { 

859 "required": True, 

860 "schema": { 

861 "title": "Item Id", 

862 "maximum": 3.0, 

863 "minimum": 1.0, 

864 "type": "integer", 

865 }, 

866 "name": "item_id", 

867 "in": "path", 

868 } 

869 ], 

870 } 

871 }, 

872 "/query": { 

873 "get": { 

874 "responses": { 

875 "200": { 

876 "description": "Successful Response", 

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

878 }, 

879 "422": { 

880 "description": "Validation Error", 

881 "content": { 

882 "application/json": { 

883 "schema": { 

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

885 } 

886 } 

887 }, 

888 }, 

889 }, 

890 "summary": "Get Query", 

891 "operationId": "get_query_query_get", 

892 "parameters": [ 

893 { 

894 "required": True, 

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

896 "name": "query", 

897 "in": "query", 

898 } 

899 ], 

900 } 

901 }, 

902 "/query/optional": { 

903 "get": { 

904 "responses": { 

905 "200": { 

906 "description": "Successful Response", 

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

908 }, 

909 "422": { 

910 "description": "Validation Error", 

911 "content": { 

912 "application/json": { 

913 "schema": { 

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

915 } 

916 } 

917 }, 

918 }, 

919 }, 

920 "summary": "Get Query Optional", 

921 "operationId": "get_query_optional_query_optional_get", 

922 "parameters": [ 

923 { 

924 "required": False, 

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

926 "name": "query", 

927 "in": "query", 

928 } 

929 ], 

930 } 

931 }, 

932 "/query/int": { 

933 "get": { 

934 "responses": { 

935 "200": { 

936 "description": "Successful Response", 

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

938 }, 

939 "422": { 

940 "description": "Validation Error", 

941 "content": { 

942 "application/json": { 

943 "schema": { 

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

945 } 

946 } 

947 }, 

948 }, 

949 }, 

950 "summary": "Get Query Type", 

951 "operationId": "get_query_type_query_int_get", 

952 "parameters": [ 

953 { 

954 "required": True, 

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

956 "name": "query", 

957 "in": "query", 

958 } 

959 ], 

960 } 

961 }, 

962 "/query/int/optional": { 

963 "get": { 

964 "responses": { 

965 "200": { 

966 "description": "Successful Response", 

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

968 }, 

969 "422": { 

970 "description": "Validation Error", 

971 "content": { 

972 "application/json": { 

973 "schema": { 

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

975 } 

976 } 

977 }, 

978 }, 

979 }, 

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

981 "operationId": "get_query_type_optional_query_int_optional_get", 

982 "parameters": [ 

983 { 

984 "name": "query", 

985 "in": "query", 

986 "required": False, 

987 "schema": IsDict( 

988 { 

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

990 "title": "Query", 

991 } 

992 ) 

993 # TODO: remove when deprecating Pydantic v1 

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

995 } 

996 ], 

997 } 

998 }, 

999 "/query/int/default": { 

1000 "get": { 

1001 "responses": { 

1002 "200": { 

1003 "description": "Successful Response", 

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

1005 }, 

1006 "422": { 

1007 "description": "Validation Error", 

1008 "content": { 

1009 "application/json": { 

1010 "schema": { 

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

1012 } 

1013 } 

1014 }, 

1015 }, 

1016 }, 

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

1018 "operationId": "get_query_type_int_default_query_int_default_get", 

1019 "parameters": [ 

1020 { 

1021 "required": False, 

1022 "schema": { 

1023 "title": "Query", 

1024 "type": "integer", 

1025 "default": 10, 

1026 }, 

1027 "name": "query", 

1028 "in": "query", 

1029 } 

1030 ], 

1031 } 

1032 }, 

1033 "/query/param": { 

1034 "get": { 

1035 "responses": { 

1036 "200": { 

1037 "description": "Successful Response", 

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

1039 }, 

1040 "422": { 

1041 "description": "Validation Error", 

1042 "content": { 

1043 "application/json": { 

1044 "schema": { 

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

1046 } 

1047 } 

1048 }, 

1049 }, 

1050 }, 

1051 "summary": "Get Query Param", 

1052 "operationId": "get_query_param_query_param_get", 

1053 "parameters": [ 

1054 { 

1055 "required": False, 

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

1057 "name": "query", 

1058 "in": "query", 

1059 } 

1060 ], 

1061 } 

1062 }, 

1063 "/query/param-required": { 

1064 "get": { 

1065 "responses": { 

1066 "200": { 

1067 "description": "Successful Response", 

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

1069 }, 

1070 "422": { 

1071 "description": "Validation Error", 

1072 "content": { 

1073 "application/json": { 

1074 "schema": { 

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

1076 } 

1077 } 

1078 }, 

1079 }, 

1080 }, 

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

1082 "operationId": "get_query_param_required_query_param_required_get", 

1083 "parameters": [ 

1084 { 

1085 "required": True, 

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

1087 "name": "query", 

1088 "in": "query", 

1089 } 

1090 ], 

1091 } 

1092 }, 

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

1094 "get": { 

1095 "responses": { 

1096 "200": { 

1097 "description": "Successful Response", 

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

1099 }, 

1100 "422": { 

1101 "description": "Validation Error", 

1102 "content": { 

1103 "application/json": { 

1104 "schema": { 

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

1106 } 

1107 } 

1108 }, 

1109 }, 

1110 }, 

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

1112 "operationId": "get_query_param_required_type_query_param_required_int_get", 

1113 "parameters": [ 

1114 { 

1115 "required": True, 

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

1117 "name": "query", 

1118 "in": "query", 

1119 } 

1120 ], 

1121 } 

1122 }, 

1123 "/enum-status-code": { 

1124 "get": { 

1125 "responses": { 

1126 "201": { 

1127 "description": "Successful Response", 

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

1129 }, 

1130 }, 

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

1132 "operationId": "get_enum_status_code_enum_status_code_get", 

1133 } 

1134 }, 

1135 "/query/frozenset": { 

1136 "get": { 

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

1138 "operationId": "get_query_type_frozenset_query_frozenset_get", 

1139 "parameters": [ 

1140 { 

1141 "required": True, 

1142 "schema": { 

1143 "title": "Query", 

1144 "uniqueItems": True, 

1145 "type": "array", 

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

1147 }, 

1148 "name": "query", 

1149 "in": "query", 

1150 } 

1151 ], 

1152 "responses": { 

1153 "200": { 

1154 "description": "Successful Response", 

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

1156 }, 

1157 "422": { 

1158 "description": "Validation Error", 

1159 "content": { 

1160 "application/json": { 

1161 "schema": { 

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

1163 } 

1164 } 

1165 }, 

1166 }, 

1167 }, 

1168 } 

1169 }, 

1170 "/query/list": { 

1171 "get": { 

1172 "summary": "Get Query List", 

1173 "operationId": "get_query_list_query_list_get", 

1174 "parameters": [ 

1175 { 

1176 "name": "device_ids", 

1177 "in": "query", 

1178 "required": True, 

1179 "schema": { 

1180 "type": "array", 

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

1182 "title": "Device Ids", 

1183 }, 

1184 } 

1185 ], 

1186 "responses": { 

1187 "200": { 

1188 "description": "Successful Response", 

1189 "content": { 

1190 "application/json": { 

1191 "schema": { 

1192 "type": "array", 

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

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

1195 } 

1196 } 

1197 }, 

1198 }, 

1199 "422": { 

1200 "description": "Validation Error", 

1201 "content": { 

1202 "application/json": { 

1203 "schema": { 

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

1205 } 

1206 } 

1207 }, 

1208 }, 

1209 }, 

1210 } 

1211 }, 

1212 "/query/list-default": { 

1213 "get": { 

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

1215 "operationId": "get_query_list_default_query_list_default_get", 

1216 "parameters": [ 

1217 { 

1218 "name": "device_ids", 

1219 "in": "query", 

1220 "required": False, 

1221 "schema": { 

1222 "type": "array", 

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

1224 "default": [], 

1225 "title": "Device Ids", 

1226 }, 

1227 } 

1228 ], 

1229 "responses": { 

1230 "200": { 

1231 "description": "Successful Response", 

1232 "content": { 

1233 "application/json": { 

1234 "schema": { 

1235 "type": "array", 

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

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

1238 } 

1239 } 

1240 }, 

1241 }, 

1242 "422": { 

1243 "description": "Validation Error", 

1244 "content": { 

1245 "application/json": { 

1246 "schema": { 

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

1248 } 

1249 } 

1250 }, 

1251 }, 

1252 }, 

1253 } 

1254 }, 

1255 }, 

1256 "components": { 

1257 "schemas": { 

1258 "ValidationError": { 

1259 "title": "ValidationError", 

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

1261 "type": "object", 

1262 "properties": { 

1263 "loc": { 

1264 "title": "Location", 

1265 "type": "array", 

1266 "items": { 

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

1268 }, 

1269 }, 

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

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

1272 }, 

1273 }, 

1274 "HTTPValidationError": { 

1275 "title": "HTTPValidationError", 

1276 "type": "object", 

1277 "properties": { 

1278 "detail": { 

1279 "title": "Detail", 

1280 "type": "array", 

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

1282 } 

1283 }, 

1284 }, 

1285 } 

1286 }, 

1287 }