Commit 97f535c
feat(openapi): switch to fastapi-based generator (#3944)
# What does this PR do?
This replaces the legacy "pyopenapi + strong_typing" pipeline with a
FastAPI-backed generator that has an explicit schema registry inside
`llama_stack_api`. The key changes:
1. **New generator architecture.** FastAPI now builds the OpenAPI schema
directly from the real routes, while helper modules
(`schema_collection`, `endpoints`, `schema_transforms`, etc.)
post-process the result. The old pyopenapi stack and its strong_typing
helpers are removed entirely, so we no longer rely on fragile AST
analysis or top-level import side effects.
2. **Schema registry in `llama_stack_api`.** `schema_utils.py` keeps a
`SchemaInfo` record for every `@json_schema_type`, `register_schema`,
and dynamically created request model. The OpenAPI generator and other
tooling query this registry instead of scanning the package tree,
producing deterministic names (e.g., `{MethodName}Request`), capturing
all optional/nullable fields, and making schema discovery testable. A
new unit test covers the registry behavior.
3. **Regenerated specs + CI alignment.** All docs/Stainless specs are
regenerated from the new pipeline, so optional/nullable fields now match
reality (expect the API Conformance workflow to report breaking
changes—this PR establishes the new baseline). The workflow itself is
back to the stock oasdiff invocation so future regressions surface
normally.
*Conformance will be RED on this PR; we choose to accept the
deviations.*
## Test Plan
- `uv run pytest tests/unit/server/test_schema_registry.py`
- `uv run python -m scripts.openapi_generator.main docs/static`
---------
Signed-off-by: Sébastien Han <[email protected]>
Co-authored-by: Ashwin Bharambe <[email protected]>1 parent cc88789 commit 97f535c
File tree
64 files changed
+47441
-30067
lines changed- client-sdks/stainless
- docs
- openapi_generator
- pyopenapi
- static
- scripts
- openapi_generator
- src
- llama_stack_api
- strong_typing
- llama_stack/core
- utils
- tests/unit/server
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
64 files changed
+47441
-30067
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
106 | 105 | | |
107 | 106 | | |
108 | 107 | | |
109 | | - | |
| 108 | + | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
| 113 | + | |
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
118 | | - | |
| 117 | + | |
119 | 118 | | |
120 | 119 | | |
121 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | 118 | | |
122 | 119 | | |
123 | 120 | | |
| |||
143 | 140 | | |
144 | 141 | | |
145 | 142 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | 143 | | |
152 | 144 | | |
153 | 145 | | |
| |||
173 | 165 | | |
174 | 166 | | |
175 | 167 | | |
| 168 | + | |
176 | 169 | | |
177 | 170 | | |
178 | 171 | | |
| |||
220 | 213 | | |
221 | 214 | | |
222 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
223 | 219 | | |
224 | 220 | | |
225 | 221 | | |
| |||
252 | 248 | | |
253 | 249 | | |
254 | 250 | | |
| 251 | + | |
255 | 252 | | |
256 | 253 | | |
257 | 254 | | |
| |||
375 | 372 | | |
376 | 373 | | |
377 | 374 | | |
| 375 | + | |
378 | 376 | | |
379 | 377 | | |
380 | 378 | | |
| |||
392 | 390 | | |
393 | 391 | | |
394 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
395 | 400 | | |
396 | 401 | | |
397 | 402 | | |
| |||
423 | 428 | | |
424 | 429 | | |
425 | 430 | | |
| 431 | + | |
426 | 432 | | |
427 | 433 | | |
428 | 434 | | |
| |||
519 | 525 | | |
520 | 526 | | |
521 | 527 | | |
522 | | - | |
| 528 | + | |
523 | 529 | | |
524 | 530 | | |
525 | 531 | | |
| |||
0 commit comments