Coverage for tests / test_application.py: 100%

34 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-02-12 18:15 +0000

1import pytest 1abcd

2from fastapi.testclient import TestClient 1abcd

3from inline_snapshot import snapshot 1abcd

4 

5from .main import app 1abcd

6 

7client = TestClient(app) 1abcd

8 

9 

10@pytest.mark.parametrize( 1abcd

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

19 response = client.get(path) 1nop

20 assert response.status_code == expected_status 1nop

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

22 

23 

24def test_swagger_ui(): 1abcd

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

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

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

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

29 assert ( 1ef

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

31 in response.text 

32 ) 

33 

34 

35def test_swagger_ui_oauth2_redirect(): 1abcd

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

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

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

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

40 

41 

42def test_redoc(): 1abcd

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

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

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

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

47 

48 

49def test_enum_status_code_response(): 1abcd

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

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

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

53 

54 

55def test_openapi_schema(): 1abcd

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

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

58 assert response.json() == snapshot( 1tuv

59 { 

60 "openapi": "3.1.0", 

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

62 "externalDocs": { 

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

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

65 }, 

66 "paths": { 

67 "/api_route": { 

68 "get": { 

69 "responses": { 

70 "200": { 

71 "description": "Successful Response", 

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

73 } 

74 }, 

75 "summary": "Non Operation", 

76 "operationId": "non_operation_api_route_get", 

77 } 

78 }, 

79 "/non_decorated_route": { 

80 "get": { 

81 "responses": { 

82 "200": { 

83 "description": "Successful Response", 

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

85 } 

86 }, 

87 "summary": "Non Decorated Route", 

88 "operationId": "non_decorated_route_non_decorated_route_get", 

89 } 

90 }, 

91 "/text": { 

92 "get": { 

93 "responses": { 

94 "200": { 

95 "description": "Successful Response", 

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

97 } 

98 }, 

99 "summary": "Get Text", 

100 "operationId": "get_text_text_get", 

101 } 

102 }, 

103 "/path/{item_id}": { 

104 "get": { 

105 "responses": { 

106 "200": { 

107 "description": "Successful Response", 

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

109 }, 

110 "422": { 

111 "description": "Validation Error", 

112 "content": { 

113 "application/json": { 

114 "schema": { 

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

116 } 

117 } 

118 }, 

119 }, 

120 }, 

121 "summary": "Get Id", 

122 "operationId": "get_id_path__item_id__get", 

123 "parameters": [ 

124 { 

125 "required": True, 

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

127 "name": "item_id", 

128 "in": "path", 

129 } 

130 ], 

131 } 

132 }, 

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

134 "get": { 

135 "responses": { 

136 "200": { 

137 "description": "Successful Response", 

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

139 }, 

140 "422": { 

141 "description": "Validation Error", 

142 "content": { 

143 "application/json": { 

144 "schema": { 

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

146 } 

147 } 

148 }, 

149 }, 

150 }, 

151 "summary": "Get Str Id", 

152 "operationId": "get_str_id_path_str__item_id__get", 

153 "parameters": [ 

154 { 

155 "required": True, 

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

157 "name": "item_id", 

158 "in": "path", 

159 } 

160 ], 

161 } 

162 }, 

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

164 "get": { 

165 "responses": { 

166 "200": { 

167 "description": "Successful Response", 

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

169 }, 

170 "422": { 

171 "description": "Validation Error", 

172 "content": { 

173 "application/json": { 

174 "schema": { 

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

176 } 

177 } 

178 }, 

179 }, 

180 }, 

181 "summary": "Get Int Id", 

182 "operationId": "get_int_id_path_int__item_id__get", 

183 "parameters": [ 

184 { 

185 "required": True, 

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

187 "name": "item_id", 

188 "in": "path", 

189 } 

190 ], 

191 } 

192 }, 

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

194 "get": { 

195 "responses": { 

196 "200": { 

197 "description": "Successful Response", 

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

199 }, 

200 "422": { 

201 "description": "Validation Error", 

202 "content": { 

203 "application/json": { 

204 "schema": { 

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

206 } 

207 } 

208 }, 

209 }, 

210 }, 

211 "summary": "Get Float Id", 

212 "operationId": "get_float_id_path_float__item_id__get", 

213 "parameters": [ 

214 { 

215 "required": True, 

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

217 "name": "item_id", 

218 "in": "path", 

219 } 

220 ], 

221 } 

222 }, 

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

224 "get": { 

225 "responses": { 

226 "200": { 

227 "description": "Successful Response", 

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

229 }, 

230 "422": { 

231 "description": "Validation Error", 

232 "content": { 

233 "application/json": { 

234 "schema": { 

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

236 } 

237 } 

238 }, 

239 }, 

240 }, 

241 "summary": "Get Bool Id", 

242 "operationId": "get_bool_id_path_bool__item_id__get", 

243 "parameters": [ 

244 { 

245 "required": True, 

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

247 "name": "item_id", 

248 "in": "path", 

249 } 

250 ], 

251 } 

252 }, 

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

254 "get": { 

255 "responses": { 

256 "200": { 

257 "description": "Successful Response", 

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

259 }, 

260 "422": { 

261 "description": "Validation Error", 

262 "content": { 

263 "application/json": { 

264 "schema": { 

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

266 } 

267 } 

268 }, 

269 }, 

270 }, 

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

272 "operationId": "get_path_param_id_path_param__item_id__get", 

273 "parameters": [ 

274 { 

275 "name": "item_id", 

276 "in": "path", 

277 "required": True, 

278 "schema": { 

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

280 "title": "Item Id", 

281 }, 

282 } 

283 ], 

284 } 

285 }, 

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

287 "get": { 

288 "responses": { 

289 "200": { 

290 "description": "Successful Response", 

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

292 }, 

293 "422": { 

294 "description": "Validation Error", 

295 "content": { 

296 "application/json": { 

297 "schema": { 

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

299 } 

300 } 

301 }, 

302 }, 

303 }, 

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

305 "operationId": "get_path_param_min_length_path_param_minlength__item_id__get", 

306 "parameters": [ 

307 { 

308 "required": True, 

309 "schema": { 

310 "title": "Item Id", 

311 "minLength": 3, 

312 "type": "string", 

313 }, 

314 "name": "item_id", 

315 "in": "path", 

316 } 

317 ], 

318 } 

319 }, 

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

321 "get": { 

322 "responses": { 

323 "200": { 

324 "description": "Successful Response", 

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

326 }, 

327 "422": { 

328 "description": "Validation Error", 

329 "content": { 

330 "application/json": { 

331 "schema": { 

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

333 } 

334 } 

335 }, 

336 }, 

337 }, 

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

339 "operationId": "get_path_param_max_length_path_param_maxlength__item_id__get", 

340 "parameters": [ 

341 { 

342 "required": True, 

343 "schema": { 

344 "title": "Item Id", 

345 "maxLength": 3, 

346 "type": "string", 

347 }, 

348 "name": "item_id", 

349 "in": "path", 

350 } 

351 ], 

352 } 

353 }, 

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

355 "get": { 

356 "responses": { 

357 "200": { 

358 "description": "Successful Response", 

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

360 }, 

361 "422": { 

362 "description": "Validation Error", 

363 "content": { 

364 "application/json": { 

365 "schema": { 

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

367 } 

368 } 

369 }, 

370 }, 

371 }, 

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

373 "operationId": "get_path_param_min_max_length_path_param_min_maxlength__item_id__get", 

374 "parameters": [ 

375 { 

376 "required": True, 

377 "schema": { 

378 "title": "Item Id", 

379 "maxLength": 3, 

380 "minLength": 2, 

381 "type": "string", 

382 }, 

383 "name": "item_id", 

384 "in": "path", 

385 } 

386 ], 

387 } 

388 }, 

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

390 "get": { 

391 "responses": { 

392 "200": { 

393 "description": "Successful Response", 

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

395 }, 

396 "422": { 

397 "description": "Validation Error", 

398 "content": { 

399 "application/json": { 

400 "schema": { 

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

402 } 

403 } 

404 }, 

405 }, 

406 }, 

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

408 "operationId": "get_path_param_gt_path_param_gt__item_id__get", 

409 "parameters": [ 

410 { 

411 "required": True, 

412 "schema": { 

413 "title": "Item Id", 

414 "exclusiveMinimum": 3.0, 

415 "type": "number", 

416 }, 

417 "name": "item_id", 

418 "in": "path", 

419 } 

420 ], 

421 } 

422 }, 

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

424 "get": { 

425 "responses": { 

426 "200": { 

427 "description": "Successful Response", 

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

429 }, 

430 "422": { 

431 "description": "Validation Error", 

432 "content": { 

433 "application/json": { 

434 "schema": { 

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

436 } 

437 } 

438 }, 

439 }, 

440 }, 

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

442 "operationId": "get_path_param_gt0_path_param_gt0__item_id__get", 

443 "parameters": [ 

444 { 

445 "required": True, 

446 "schema": { 

447 "title": "Item Id", 

448 "exclusiveMinimum": 0.0, 

449 "type": "number", 

450 }, 

451 "name": "item_id", 

452 "in": "path", 

453 } 

454 ], 

455 } 

456 }, 

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

458 "get": { 

459 "responses": { 

460 "200": { 

461 "description": "Successful Response", 

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

463 }, 

464 "422": { 

465 "description": "Validation Error", 

466 "content": { 

467 "application/json": { 

468 "schema": { 

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

470 } 

471 } 

472 }, 

473 }, 

474 }, 

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

476 "operationId": "get_path_param_ge_path_param_ge__item_id__get", 

477 "parameters": [ 

478 { 

479 "required": True, 

480 "schema": { 

481 "title": "Item Id", 

482 "minimum": 3.0, 

483 "type": "number", 

484 }, 

485 "name": "item_id", 

486 "in": "path", 

487 } 

488 ], 

489 } 

490 }, 

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

492 "get": { 

493 "responses": { 

494 "200": { 

495 "description": "Successful Response", 

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

497 }, 

498 "422": { 

499 "description": "Validation Error", 

500 "content": { 

501 "application/json": { 

502 "schema": { 

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

504 } 

505 } 

506 }, 

507 }, 

508 }, 

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

510 "operationId": "get_path_param_lt_path_param_lt__item_id__get", 

511 "parameters": [ 

512 { 

513 "required": True, 

514 "schema": { 

515 "title": "Item Id", 

516 "exclusiveMaximum": 3.0, 

517 "type": "number", 

518 }, 

519 "name": "item_id", 

520 "in": "path", 

521 } 

522 ], 

523 } 

524 }, 

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

526 "get": { 

527 "responses": { 

528 "200": { 

529 "description": "Successful Response", 

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

531 }, 

532 "422": { 

533 "description": "Validation Error", 

534 "content": { 

535 "application/json": { 

536 "schema": { 

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

538 } 

539 } 

540 }, 

541 }, 

542 }, 

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

544 "operationId": "get_path_param_lt0_path_param_lt0__item_id__get", 

545 "parameters": [ 

546 { 

547 "required": True, 

548 "schema": { 

549 "title": "Item Id", 

550 "exclusiveMaximum": 0.0, 

551 "type": "number", 

552 }, 

553 "name": "item_id", 

554 "in": "path", 

555 } 

556 ], 

557 } 

558 }, 

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

560 "get": { 

561 "responses": { 

562 "200": { 

563 "description": "Successful Response", 

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

565 }, 

566 "422": { 

567 "description": "Validation Error", 

568 "content": { 

569 "application/json": { 

570 "schema": { 

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

572 } 

573 } 

574 }, 

575 }, 

576 }, 

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

578 "operationId": "get_path_param_le_path_param_le__item_id__get", 

579 "parameters": [ 

580 { 

581 "required": True, 

582 "schema": { 

583 "title": "Item Id", 

584 "maximum": 3.0, 

585 "type": "number", 

586 }, 

587 "name": "item_id", 

588 "in": "path", 

589 } 

590 ], 

591 } 

592 }, 

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

594 "get": { 

595 "responses": { 

596 "200": { 

597 "description": "Successful Response", 

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

599 }, 

600 "422": { 

601 "description": "Validation Error", 

602 "content": { 

603 "application/json": { 

604 "schema": { 

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

606 } 

607 } 

608 }, 

609 }, 

610 }, 

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

612 "operationId": "get_path_param_lt_gt_path_param_lt_gt__item_id__get", 

613 "parameters": [ 

614 { 

615 "required": True, 

616 "schema": { 

617 "title": "Item Id", 

618 "exclusiveMaximum": 3.0, 

619 "exclusiveMinimum": 1.0, 

620 "type": "number", 

621 }, 

622 "name": "item_id", 

623 "in": "path", 

624 } 

625 ], 

626 } 

627 }, 

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

629 "get": { 

630 "responses": { 

631 "200": { 

632 "description": "Successful Response", 

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

634 }, 

635 "422": { 

636 "description": "Validation Error", 

637 "content": { 

638 "application/json": { 

639 "schema": { 

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

641 } 

642 } 

643 }, 

644 }, 

645 }, 

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

647 "operationId": "get_path_param_le_ge_path_param_le_ge__item_id__get", 

648 "parameters": [ 

649 { 

650 "required": True, 

651 "schema": { 

652 "title": "Item Id", 

653 "maximum": 3.0, 

654 "minimum": 1.0, 

655 "type": "number", 

656 }, 

657 "name": "item_id", 

658 "in": "path", 

659 } 

660 ], 

661 } 

662 }, 

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

664 "get": { 

665 "responses": { 

666 "200": { 

667 "description": "Successful Response", 

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

669 }, 

670 "422": { 

671 "description": "Validation Error", 

672 "content": { 

673 "application/json": { 

674 "schema": { 

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

676 } 

677 } 

678 }, 

679 }, 

680 }, 

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

682 "operationId": "get_path_param_lt_int_path_param_lt_int__item_id__get", 

683 "parameters": [ 

684 { 

685 "required": True, 

686 "schema": { 

687 "title": "Item Id", 

688 "exclusiveMaximum": 3.0, 

689 "type": "integer", 

690 }, 

691 "name": "item_id", 

692 "in": "path", 

693 } 

694 ], 

695 } 

696 }, 

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

698 "get": { 

699 "responses": { 

700 "200": { 

701 "description": "Successful Response", 

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

703 }, 

704 "422": { 

705 "description": "Validation Error", 

706 "content": { 

707 "application/json": { 

708 "schema": { 

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

710 } 

711 } 

712 }, 

713 }, 

714 }, 

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

716 "operationId": "get_path_param_gt_int_path_param_gt_int__item_id__get", 

717 "parameters": [ 

718 { 

719 "required": True, 

720 "schema": { 

721 "title": "Item Id", 

722 "exclusiveMinimum": 3.0, 

723 "type": "integer", 

724 }, 

725 "name": "item_id", 

726 "in": "path", 

727 } 

728 ], 

729 } 

730 }, 

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

732 "get": { 

733 "responses": { 

734 "200": { 

735 "description": "Successful Response", 

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

737 }, 

738 "422": { 

739 "description": "Validation Error", 

740 "content": { 

741 "application/json": { 

742 "schema": { 

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

744 } 

745 } 

746 }, 

747 }, 

748 }, 

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

750 "operationId": "get_path_param_le_int_path_param_le_int__item_id__get", 

751 "parameters": [ 

752 { 

753 "required": True, 

754 "schema": { 

755 "title": "Item Id", 

756 "maximum": 3.0, 

757 "type": "integer", 

758 }, 

759 "name": "item_id", 

760 "in": "path", 

761 } 

762 ], 

763 } 

764 }, 

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

766 "get": { 

767 "responses": { 

768 "200": { 

769 "description": "Successful Response", 

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

771 }, 

772 "422": { 

773 "description": "Validation Error", 

774 "content": { 

775 "application/json": { 

776 "schema": { 

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

778 } 

779 } 

780 }, 

781 }, 

782 }, 

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

784 "operationId": "get_path_param_ge_int_path_param_ge_int__item_id__get", 

785 "parameters": [ 

786 { 

787 "required": True, 

788 "schema": { 

789 "title": "Item Id", 

790 "minimum": 3.0, 

791 "type": "integer", 

792 }, 

793 "name": "item_id", 

794 "in": "path", 

795 } 

796 ], 

797 } 

798 }, 

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

800 "get": { 

801 "responses": { 

802 "200": { 

803 "description": "Successful Response", 

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

805 }, 

806 "422": { 

807 "description": "Validation Error", 

808 "content": { 

809 "application/json": { 

810 "schema": { 

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

812 } 

813 } 

814 }, 

815 }, 

816 }, 

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

818 "operationId": "get_path_param_lt_gt_int_path_param_lt_gt_int__item_id__get", 

819 "parameters": [ 

820 { 

821 "required": True, 

822 "schema": { 

823 "title": "Item Id", 

824 "exclusiveMaximum": 3.0, 

825 "exclusiveMinimum": 1.0, 

826 "type": "integer", 

827 }, 

828 "name": "item_id", 

829 "in": "path", 

830 } 

831 ], 

832 } 

833 }, 

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

835 "get": { 

836 "responses": { 

837 "200": { 

838 "description": "Successful Response", 

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

840 }, 

841 "422": { 

842 "description": "Validation Error", 

843 "content": { 

844 "application/json": { 

845 "schema": { 

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

847 } 

848 } 

849 }, 

850 }, 

851 }, 

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

853 "operationId": "get_path_param_le_ge_int_path_param_le_ge_int__item_id__get", 

854 "parameters": [ 

855 { 

856 "required": True, 

857 "schema": { 

858 "title": "Item Id", 

859 "maximum": 3.0, 

860 "minimum": 1.0, 

861 "type": "integer", 

862 }, 

863 "name": "item_id", 

864 "in": "path", 

865 } 

866 ], 

867 } 

868 }, 

869 "/query": { 

870 "get": { 

871 "responses": { 

872 "200": { 

873 "description": "Successful Response", 

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

875 }, 

876 "422": { 

877 "description": "Validation Error", 

878 "content": { 

879 "application/json": { 

880 "schema": { 

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

882 } 

883 } 

884 }, 

885 }, 

886 }, 

887 "summary": "Get Query", 

888 "operationId": "get_query_query_get", 

889 "parameters": [ 

890 { 

891 "required": True, 

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

893 "name": "query", 

894 "in": "query", 

895 } 

896 ], 

897 } 

898 }, 

899 "/query/optional": { 

900 "get": { 

901 "responses": { 

902 "200": { 

903 "description": "Successful Response", 

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

905 }, 

906 "422": { 

907 "description": "Validation Error", 

908 "content": { 

909 "application/json": { 

910 "schema": { 

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

912 } 

913 } 

914 }, 

915 }, 

916 }, 

917 "summary": "Get Query Optional", 

918 "operationId": "get_query_optional_query_optional_get", 

919 "parameters": [ 

920 { 

921 "required": False, 

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

923 "name": "query", 

924 "in": "query", 

925 } 

926 ], 

927 } 

928 }, 

929 "/query/int": { 

930 "get": { 

931 "responses": { 

932 "200": { 

933 "description": "Successful Response", 

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

935 }, 

936 "422": { 

937 "description": "Validation Error", 

938 "content": { 

939 "application/json": { 

940 "schema": { 

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

942 } 

943 } 

944 }, 

945 }, 

946 }, 

947 "summary": "Get Query Type", 

948 "operationId": "get_query_type_query_int_get", 

949 "parameters": [ 

950 { 

951 "required": True, 

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

953 "name": "query", 

954 "in": "query", 

955 } 

956 ], 

957 } 

958 }, 

959 "/query/int/optional": { 

960 "get": { 

961 "responses": { 

962 "200": { 

963 "description": "Successful Response", 

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

965 }, 

966 "422": { 

967 "description": "Validation Error", 

968 "content": { 

969 "application/json": { 

970 "schema": { 

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

972 } 

973 } 

974 }, 

975 }, 

976 }, 

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

978 "operationId": "get_query_type_optional_query_int_optional_get", 

979 "parameters": [ 

980 { 

981 "name": "query", 

982 "in": "query", 

983 "required": False, 

984 "schema": { 

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

986 "title": "Query", 

987 }, 

988 } 

989 ], 

990 } 

991 }, 

992 "/query/int/default": { 

993 "get": { 

994 "responses": { 

995 "200": { 

996 "description": "Successful Response", 

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

998 }, 

999 "422": { 

1000 "description": "Validation Error", 

1001 "content": { 

1002 "application/json": { 

1003 "schema": { 

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

1005 } 

1006 } 

1007 }, 

1008 }, 

1009 }, 

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

1011 "operationId": "get_query_type_int_default_query_int_default_get", 

1012 "parameters": [ 

1013 { 

1014 "required": False, 

1015 "schema": { 

1016 "title": "Query", 

1017 "type": "integer", 

1018 "default": 10, 

1019 }, 

1020 "name": "query", 

1021 "in": "query", 

1022 } 

1023 ], 

1024 } 

1025 }, 

1026 "/query/param": { 

1027 "get": { 

1028 "responses": { 

1029 "200": { 

1030 "description": "Successful Response", 

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

1032 }, 

1033 "422": { 

1034 "description": "Validation Error", 

1035 "content": { 

1036 "application/json": { 

1037 "schema": { 

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

1039 } 

1040 } 

1041 }, 

1042 }, 

1043 }, 

1044 "summary": "Get Query Param", 

1045 "operationId": "get_query_param_query_param_get", 

1046 "parameters": [ 

1047 { 

1048 "required": False, 

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

1050 "name": "query", 

1051 "in": "query", 

1052 } 

1053 ], 

1054 } 

1055 }, 

1056 "/query/param-required": { 

1057 "get": { 

1058 "responses": { 

1059 "200": { 

1060 "description": "Successful Response", 

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

1062 }, 

1063 "422": { 

1064 "description": "Validation Error", 

1065 "content": { 

1066 "application/json": { 

1067 "schema": { 

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

1069 } 

1070 } 

1071 }, 

1072 }, 

1073 }, 

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

1075 "operationId": "get_query_param_required_query_param_required_get", 

1076 "parameters": [ 

1077 { 

1078 "required": True, 

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

1080 "name": "query", 

1081 "in": "query", 

1082 } 

1083 ], 

1084 } 

1085 }, 

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

1087 "get": { 

1088 "responses": { 

1089 "200": { 

1090 "description": "Successful Response", 

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

1092 }, 

1093 "422": { 

1094 "description": "Validation Error", 

1095 "content": { 

1096 "application/json": { 

1097 "schema": { 

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

1099 } 

1100 } 

1101 }, 

1102 }, 

1103 }, 

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

1105 "operationId": "get_query_param_required_type_query_param_required_int_get", 

1106 "parameters": [ 

1107 { 

1108 "required": True, 

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

1110 "name": "query", 

1111 "in": "query", 

1112 } 

1113 ], 

1114 } 

1115 }, 

1116 "/enum-status-code": { 

1117 "get": { 

1118 "responses": { 

1119 "201": { 

1120 "description": "Successful Response", 

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

1122 }, 

1123 }, 

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

1125 "operationId": "get_enum_status_code_enum_status_code_get", 

1126 } 

1127 }, 

1128 "/query/frozenset": { 

1129 "get": { 

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

1131 "operationId": "get_query_type_frozenset_query_frozenset_get", 

1132 "parameters": [ 

1133 { 

1134 "required": True, 

1135 "schema": { 

1136 "title": "Query", 

1137 "uniqueItems": True, 

1138 "type": "array", 

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

1140 }, 

1141 "name": "query", 

1142 "in": "query", 

1143 } 

1144 ], 

1145 "responses": { 

1146 "200": { 

1147 "description": "Successful Response", 

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

1149 }, 

1150 "422": { 

1151 "description": "Validation Error", 

1152 "content": { 

1153 "application/json": { 

1154 "schema": { 

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

1156 } 

1157 } 

1158 }, 

1159 }, 

1160 }, 

1161 } 

1162 }, 

1163 "/query/list": { 

1164 "get": { 

1165 "summary": "Get Query List", 

1166 "operationId": "get_query_list_query_list_get", 

1167 "parameters": [ 

1168 { 

1169 "name": "device_ids", 

1170 "in": "query", 

1171 "required": True, 

1172 "schema": { 

1173 "type": "array", 

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

1175 "title": "Device Ids", 

1176 }, 

1177 } 

1178 ], 

1179 "responses": { 

1180 "200": { 

1181 "description": "Successful Response", 

1182 "content": { 

1183 "application/json": { 

1184 "schema": { 

1185 "type": "array", 

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

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

1188 } 

1189 } 

1190 }, 

1191 }, 

1192 "422": { 

1193 "description": "Validation Error", 

1194 "content": { 

1195 "application/json": { 

1196 "schema": { 

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

1198 } 

1199 } 

1200 }, 

1201 }, 

1202 }, 

1203 } 

1204 }, 

1205 "/query/list-default": { 

1206 "get": { 

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

1208 "operationId": "get_query_list_default_query_list_default_get", 

1209 "parameters": [ 

1210 { 

1211 "name": "device_ids", 

1212 "in": "query", 

1213 "required": False, 

1214 "schema": { 

1215 "type": "array", 

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

1217 "default": [], 

1218 "title": "Device Ids", 

1219 }, 

1220 } 

1221 ], 

1222 "responses": { 

1223 "200": { 

1224 "description": "Successful Response", 

1225 "content": { 

1226 "application/json": { 

1227 "schema": { 

1228 "type": "array", 

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

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

1231 } 

1232 } 

1233 }, 

1234 }, 

1235 "422": { 

1236 "description": "Validation Error", 

1237 "content": { 

1238 "application/json": { 

1239 "schema": { 

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

1241 } 

1242 } 

1243 }, 

1244 }, 

1245 }, 

1246 } 

1247 }, 

1248 }, 

1249 "components": { 

1250 "schemas": { 

1251 "ValidationError": { 

1252 "title": "ValidationError", 

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

1254 "type": "object", 

1255 "properties": { 

1256 "loc": { 

1257 "title": "Location", 

1258 "type": "array", 

1259 "items": { 

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

1261 }, 

1262 }, 

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

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

1265 "input": {"title": "Input"}, 

1266 "ctx": {"title": "Context", "type": "object"}, 

1267 }, 

1268 }, 

1269 "HTTPValidationError": { 

1270 "title": "HTTPValidationError", 

1271 "type": "object", 

1272 "properties": { 

1273 "detail": { 

1274 "title": "Detail", 

1275 "type": "array", 

1276 "items": { 

1277 "$ref": "#/components/schemas/ValidationError" 

1278 }, 

1279 } 

1280 }, 

1281 }, 

1282 } 

1283 }, 

1284 } 

1285 )