From 500804f0ebfd88b51171876715d26be3bc921c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 12 Nov 2025 14:48:34 +0100 Subject: [PATCH] chore: add deprecated to combined schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- client-sdks/stainless/openapi.yml | 32 +++++++++++++++++++++ docs/static/stainless-llama-stack-spec.yaml | 32 +++++++++++++++++++++ scripts/fastapi_generator.py | 15 ++++------ 3 files changed, 70 insertions(+), 9 deletions(-) diff --git a/client-sdks/stainless/openapi.yml b/client-sdks/stainless/openapi.yml index 55b5a2b8f..ef70cdbce 100644 --- a/client-sdks/stainless/openapi.yml +++ b/client-sdks/stainless/openapi.yml @@ -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: diff --git a/docs/static/stainless-llama-stack-spec.yaml b/docs/static/stainless-llama-stack-spec.yaml index fdbc2c6f4..9851d15db 100644 --- a/docs/static/stainless-llama-stack-spec.yaml +++ b/docs/static/stainless-llama-stack-spec.yaml @@ -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: diff --git a/scripts/fastapi_generator.py b/scripts/fastapi_generator.py index 3f573f1cc..1561e9b35 100755 --- a/scripts/fastapi_generator.py +++ b/scripts/fastapi_generator.py @@ -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):