-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(openapi): switch to fastapi-based generator #3944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This is amazing, thanks for it. It will reduce a lot of random complexity in the openapi generator. |
|
The only comment I have is the removal of In the current implementation, we use this annotations implicitly to generate a top-level "component schema" in the YAML. If we make every BaseModel be a top-level component schema, the yaml becomes harder to consume in a few places due to annoying indirection. Simple things which are just used once in the API are often best situated as inline objects |
cdbce6c to
e339650
Compare
While working on llamastack#3944 I realized that the batches API wasn't generated. Signed-off-by: Sébastien Han <[email protected]>
# What does this PR do? While working on #3944 I realized that the batches API wasn't generated. Signed-off-by: Sébastien Han <[email protected]>
e339650 to
dd67339
Compare
While working on llamastack#3944 I realized that the batches API wasn't generated. Signed-off-by: Sébastien Han <[email protected]> Signed-off-by: Charlie Doern <[email protected]>
fe54754 to
f59b570
Compare
a13512a to
b80fdf1
Compare
Signed-off-by: Sébastien Han <[email protected]>
Matches llamastack#4156 Signed-off-by: Sébastien Han <[email protected]>
Signed-off-by: Sébastien Han <[email protected]>
c6d7196 to
2785819
Compare
Signed-off-by: Sébastien Han <[email protected]>
This reverts commit 8427798. Signed-off-by: Sébastien Han <[email protected]>
This reverts commit 7bc9aea. Signed-off-by: Sébastien Han <[email protected]>
Signed-off-by: Sébastien Han <[email protected]>
This reverts commit 06acbda. Signed-off-by: Sébastien Han <[email protected]>
use paginated endpoint for example and mark input_items.list as non-paginated Signed-off-by: Sébastien Han <[email protected]>
Signed-off-by: Sébastien Han <[email protected]>
delete /v1/scoring-functions/{scoring_fn_id} exists in the OpenAPI spec,
but isn't specified in the Stainless config, so code will not be
generated for it.
delete /v1alpha/eval/benchmarks/{benchmark_id} exists in the OpenAPI
spec, but isn't specified in the Stainless config, so code will not be
generated for it
Signed-off-by: Sébastien Han <[email protected]>
This reverts commit 9a36669. Signed-off-by: Sébastien Han <[email protected]>
Signed-off-by: Sébastien Han <[email protected]>
|
This is the Stainless diff (after I resolved some modify-delete conflicts) It appears to be clean and nice, still reviewing. |
|
It is looking quite good. Sadly we really cannot run an e2e test because the preview branches are not mirrored into the destination (production) repository ( I am landing this now, will check build status once Stainless updates the production repository. CI on llamastack/llama-stack-client-python#302 is green! |
It was referencing strong_typing which was removed in llamastack#3944 Signed-off-by: Sébastien Han <[email protected]>
# What does this PR do? It was referencing strong_typing which was removed in #3944 ## Test Plan New CI build test. Signed-off-by: Sébastien Han <[email protected]>
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: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.Schema registry in
llama_stack_api.schema_utils.pykeeps aSchemaInforecord 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.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.pyuv run python -m scripts.openapi_generator.main docs/static