mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
chore: add deprecated to combined schema
The _filter_combined_schema function was excluding deprecated operations. I updated it to include all operations (deprecated and non-deprecated) for the combined/stainless spec, so these deprecated endpoints are now included. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
73861b504d
commit
500804f0eb
3 changed files with 70 additions and 9 deletions
|
|
@ -3460,6 +3460,38 @@ paths:
|
|||
default:
|
||||
description: Default Response
|
||||
$ref: '#/components/responses/DefaultError'
|
||||
post:
|
||||
tags:
|
||||
- Shields
|
||||
summary: Register Shield
|
||||
description: Register a shield.
|
||||
operationId: register_shield_v1_shields_post
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/_shields_Request'
|
||||
required: true
|
||||
responses:
|
||||
'200':
|
||||
description: A Shield.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Shield'
|
||||
'400':
|
||||
description: Bad Request
|
||||
$ref: '#/components/responses/BadRequest400'
|
||||
'429':
|
||||
description: Too Many Requests
|
||||
$ref: '#/components/responses/TooManyRequests429'
|
||||
'500':
|
||||
description: Internal Server Error
|
||||
$ref: '#/components/responses/InternalServerError500'
|
||||
default:
|
||||
description: Default Response
|
||||
$ref: '#/components/responses/DefaultError'
|
||||
deprecated: true
|
||||
/v1beta/datasetio/append-rows/{dataset_id}:
|
||||
post:
|
||||
tags:
|
||||
|
|
|
|||
32
docs/static/stainless-llama-stack-spec.yaml
vendored
32
docs/static/stainless-llama-stack-spec.yaml
vendored
|
|
@ -3446,6 +3446,38 @@ paths:
|
|||
default:
|
||||
description: Default Response
|
||||
$ref: '#/components/responses/DefaultError'
|
||||
post:
|
||||
tags:
|
||||
- Shields
|
||||
summary: Register Shield
|
||||
description: Register a shield.
|
||||
operationId: register_shield_v1_shields_post
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/_shields_Request'
|
||||
required: true
|
||||
responses:
|
||||
'200':
|
||||
description: A Shield.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Shield'
|
||||
'400':
|
||||
description: Bad Request
|
||||
$ref: '#/components/responses/BadRequest400'
|
||||
'429':
|
||||
description: Too Many Requests
|
||||
$ref: '#/components/responses/TooManyRequests429'
|
||||
'500':
|
||||
description: Internal Server Error
|
||||
$ref: '#/components/responses/InternalServerError500'
|
||||
default:
|
||||
description: Default Response
|
||||
$ref: '#/components/responses/DefaultError'
|
||||
deprecated: true
|
||||
/v1beta/datasetio/append-rows/{dataset_id}:
|
||||
post:
|
||||
tags:
|
||||
|
|
|
|||
|
|
@ -1637,21 +1637,21 @@ def _filter_deprecated_schema(openapi_schema: dict[str, Any]) -> dict[str, Any]:
|
|||
def _filter_combined_schema(openapi_schema: dict[str, Any]) -> dict[str, Any]:
|
||||
"""
|
||||
Filter OpenAPI schema to include both stable (v1) and experimental (v1alpha, v1beta) APIs.
|
||||
Excludes deprecated endpoints. This is used for the combined "stainless" spec.
|
||||
Includes deprecated endpoints. This is used for the combined "stainless" spec.
|
||||
"""
|
||||
filtered_schema = openapi_schema.copy()
|
||||
|
||||
if "paths" not in filtered_schema:
|
||||
return filtered_schema
|
||||
|
||||
# Filter paths to include stable (v1) and experimental (v1alpha, v1beta), excluding deprecated
|
||||
# Filter paths to include stable (v1) and experimental (v1alpha, v1beta), including deprecated
|
||||
filtered_paths = {}
|
||||
for path, path_item in filtered_schema["paths"].items():
|
||||
if not isinstance(path_item, dict):
|
||||
continue
|
||||
|
||||
# Filter at operation level, not path level
|
||||
# This allows paths with both deprecated and non-deprecated operations
|
||||
# Include all operations (both deprecated and non-deprecated) for the combined spec
|
||||
# Filter at operation level to preserve the structure
|
||||
filtered_path_item = {}
|
||||
for method in ["get", "post", "put", "delete", "patch", "head", "options"]:
|
||||
if method not in path_item:
|
||||
|
|
@ -1660,13 +1660,10 @@ def _filter_combined_schema(openapi_schema: dict[str, Any]) -> dict[str, Any]:
|
|||
if not isinstance(operation, dict):
|
||||
continue
|
||||
|
||||
# Skip deprecated operations
|
||||
if operation.get("deprecated", False):
|
||||
continue
|
||||
|
||||
# Include all operations, including deprecated ones
|
||||
filtered_path_item[method] = operation
|
||||
|
||||
# Only include path if it has at least one operation after filtering
|
||||
# Only include path if it has at least one operation
|
||||
if filtered_path_item:
|
||||
# Check if path matches version filter (stable or experimental)
|
||||
if _is_stable_path(path) or _is_experimental_path(path):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue