Repository navigation
Commit cbb8208
committed
Refactor AST emitters/parsers for bi-directional IR symmetry, strict typing, and 100% test/doc coverage
- [.gitignore, .coveragerc]: Anchor root-level ignore rules (/client.py, /src/client.py) so src/openapi_client/mcp_client/client.py is tracked; configure branch coverage across src/openapi_client and scripts without scratch-file omissions.
- [src/openapi_client/openapi/keywords.py]: Deduplicate ~3,900 lines of copy-pasted _OPENAPI_3_2_0_FIELDS and _ALL_KEYWORDS tuples across 17 modules into canonical OPENAPI_3_2_0_FIELDS and ALL_KEYWORDS constants.
- [src/openapi_client/classes/{emit,parse}.py]: Support PEP 604 union (T | None), Optional[T], list[T], dict[str, T], required vs optional fields, and $ref schema resolution in both Pydantic emission and LibCST ClassExtractor.
- [src/openapi_client/functions/{emit,parse,utils}.py]: Extract HTTP verb and URL path from client method bodies (self.base_url + ... and self.http.request) in FunctionExtractor so custom operationIds round-trip; guard query string concatenation against trailing '?' when query_params is empty; add get_default_server_url helper.
- [src/openapi_client/fastapi/{emit,parse}.py]: Construct typed PathItem and Operation Pydantic models instead of raw dicts in FastAPIExtractor; support both @app.<method> and @router.<method> decorators; sanitize route tags into valid Python module identifiers; emit 422 JSONResponse when strict_validation is enabled.
- [src/openapi_client/cli_sdk/emit_mcp*.py, src/openapi_client/mcp.py]: Consolidate OpenAPI-to-MCP tool schema extraction into extract_mcp_tools_from_spec; delegate tools/list, resources/list, and resources/read in cli.py:run_mcp_server to openapi_client.mcp; use http.server.HTTPServer in serve_json_rpc.
- [src/openapi_client/cli.py]: Implement --truth filtering in sync_dir; pass args.mcp to generate_from_openapi; merge AST changes on top of openapi.snapshot.json in generate_to_openapi.
- [src/openapi_client/tests/{emit,parse}.py]: Replace hardcoded Petstore/Chaos-audit literals with schema-driven example/default/enum/format resolution and response status code inspection; implement SSE response extraction in ASTTestExtractor; implement parse_cli_sdk_cdd and parse_sqlalchemy_cdd.
- [src/**, scripts/**]: Enforce from __future__ import annotations, complete PEP 484 parameter/return type annotations, remove all # type: ignore suppressions and dead Pydantic v1 fallbacks, and extend scripts/doc_coverage.py to verify argument docstrings.
- [tests/*]: Isolate all filesystem tests via tmp_path/monkeypatch, replace tautological/empty pass tests with behavioral assertions, and consolidate 41 fragmented test files into 12 domain-aligned test modules achieving 100.00% line/branch and docstring coverage.1 parent 8d38bb4 commit cbb8208
113 files changed
Lines changed: 6594 additions & 9534 deletions
File tree
- scripts
- src
- openapi_client
- classes
- cli_sdk_cdd
- cli_sdk
- dao
- db
- docstrings
- fastapi
- functions
- mcp_client
- mocks
- openapi
- routes
- seeder
- sqlalchemy_cdd
- tests
- tests
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 9 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 10 | | |
47 | 11 | | |
48 | 12 | | |
49 | | - | |
50 | | - | |
51 | 13 | | |
52 | | - | |
53 | | - | |
54 | 14 | | |
55 | 15 | | |
56 | 16 | | |
| |||
59 | 19 | | |
60 | 20 | | |
61 | 21 | | |
62 | | - | |
63 | | - | |
64 | 22 | | |
65 | 23 | | |
66 | 24 | | |
67 | 25 | | |
68 | 26 | | |
69 | | - | |
70 | | - | |
| 27 | + | |
71 | 28 | | |
72 | 29 | | |
73 | 30 | | |
74 | 31 | | |
75 | 32 | | |
76 | | - | |
77 | | - | |
| 33 | + | |
| 34 | + | |
78 | 35 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | 36 | | |
91 | 37 | | |
92 | 38 | | |
93 | 39 | | |
94 | | - | |
95 | | - | |
96 | 40 | | |
97 | 41 | | |
98 | 42 | | |
99 | 43 | | |
100 | 44 | | |
101 | 45 | | |
102 | 46 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | 47 | | |
112 | 48 | | |
113 | 49 | | |
| |||
119 | 55 | | |
120 | 56 | | |
121 | 57 | | |
122 | | - | |
123 | | - | |
124 | 58 | | |
125 | 59 | | |
126 | 60 | | |
127 | | - | |
128 | | - | |
129 | 61 | | |
130 | 62 | | |
131 | 63 | | |
| |||
136 | 68 | | |
137 | 69 | | |
138 | 70 | | |
139 | | - | |
140 | | - | |
141 | 71 | | |
142 | 72 | | |
143 | 73 | | |
| |||
147 | 77 | | |
148 | 78 | | |
149 | 79 | | |
150 | | - | |
151 | | - | |
152 | 80 | | |
153 | 81 | | |
154 | | - | |
155 | | - | |
156 | 82 | | |
157 | 83 | | |
158 | 84 | | |
159 | 85 | | |
160 | 86 | | |
161 | 87 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
166 | 116 | | |
167 | 117 | | |
168 | 118 | | |
169 | 119 | | |
170 | 120 | | |
171 | | - | |
172 | 121 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | | - | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | | - | |
8 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 | | |
10 | 19 | | |
11 | 20 | | |
| |||
18 | 27 | | |
19 | 28 | | |
20 | 29 | | |
21 | | - | |
| 30 | + | |
22 | 31 | | |
23 | 32 | | |
24 | | - | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
| |||
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
35 | | - | |
36 | 43 | | |
37 | 44 | | |
38 | | - | |
39 | | - | |
40 | 45 | | |
41 | | - | |
| 46 | + | |
| 47 | + | |
42 | 48 | | |
43 | 49 | | |
44 | 50 | | |
45 | 51 | | |
46 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
47 | 65 | | |
48 | 66 | | |
49 | 67 | | |
| |||
0 commit comments