Skip to content

Commit 6eff984

Browse files
authored
Merge branch 'main' into response_streaming_type_fix
2 parents ce621d8 + 5e0156d commit 6eff984

12 files changed

Lines changed: 739 additions & 2040 deletions

File tree

client-sdks/stainless/openapi.yml

Lines changed: 5 additions & 365 deletions
Large diffs are not rendered by default.

docs/docs/api-openai/conformance.mdx

Lines changed: 228 additions & 154 deletions
Large diffs are not rendered by default.

docs/static/deprecated-llama-stack-spec.yaml

Lines changed: 3 additions & 360 deletions
Large diffs are not rendered by default.

docs/static/experimental-llama-stack-spec.yaml

Lines changed: 3 additions & 354 deletions
Large diffs are not rendered by default.

docs/static/llama-stack-spec.yaml

Lines changed: 5 additions & 362 deletions
Large diffs are not rendered by default.

docs/static/openai-coverage.json

Lines changed: 406 additions & 76 deletions
Large diffs are not rendered by default.

docs/static/stainless-llama-stack-spec.yaml

Lines changed: 5 additions & 365 deletions
Large diffs are not rendered by default.

scripts/openapi_generator/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def generate_openapi_spec(output_dir: str) -> dict[str, Any]:
7676
# that FastAPI incorrectly added to GET endpoints are removed
7777
openapi_schema = schema_transforms._remove_request_bodies_from_get_endpoints(openapi_schema)
7878

79+
# Remove 'type: object' from schemas with properties (OpenAI spec conformance)
80+
openapi_schema = schema_transforms._remove_type_object_from_openai_schemas(openapi_schema)
81+
7982
# Extract duplicate union types to shared schema references
8083
openapi_schema = schema_transforms._extract_duplicate_union_types(openapi_schema)
8184

scripts/openapi_generator/schema_transforms.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,21 @@ def order_mapping(data: dict[str, Any], priority: list[str]) -> OrderedDict[str,
10081008
return openapi_schema
10091009

10101010

1011+
def _remove_type_object_from_openai_schemas(openapi_schema: dict[str, Any]) -> dict[str, Any]:
1012+
"""Remove redundant 'type: object' from schemas that have 'properties' defined.
1013+
1014+
The OpenAI spec does not include an explicit ``type: object`` on schemas
1015+
that already declare ``properties`` (the presence of ``properties`` implies
1016+
object type per JSON Schema). Pydantic adds ``type: object`` automatically,
1017+
so we strip it from all schemas with ``properties`` to stay conformant.
1018+
"""
1019+
schemas = openapi_schema.get("components", {}).get("schemas", {})
1020+
for schema_def in schemas.values():
1021+
if isinstance(schema_def, dict) and schema_def.get("type") == "object" and "properties" in schema_def:
1022+
del schema_def["type"]
1023+
return openapi_schema
1024+
1025+
10111026
def _fix_schema_issues(openapi_schema: dict[str, Any]) -> dict[str, Any]:
10121027
"""Fix common schema issues: exclusiveMinimum, null defaults, and add titles to unions."""
10131028
# Convert anyOf with const values to enums across the entire schema

src/llama_stack_api/files/fastapi_routes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ async def delete_file(
9696
description="Retrieve file content",
9797
responses={
9898
200: {
99-
"description": "The raw file content as a binary response.",
100-
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Response"}}},
99+
"description": "The file content.",
100+
"content": {"application/json": {"schema": {"type": "string"}}},
101101
},
102102
},
103103
)

0 commit comments

Comments
 (0)