litellm/tests/integration/compatibility/test_responses_openapi_schema.py
devin-ai-integration[bot] 35225709ed
test(integration): cover customer reported cache key, cache_control, bedrock request id, responses schema, scim and tag budget contracts (#42785)
* test(integration): cover prompt cache key, system cache_control, bedrock request id, responses schema, scim and tag budget contracts

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(integration): drop invented instructions shape and unused imports

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(integration): register scim placeholder cleanup before asserting the patch

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: kerry <kerry@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-23 13:19:38 -07:00

21 lines
1.1 KiB
Python

import pytest
from integration._support.client import Gateway, object_value
from pydantic import JsonValue
def _assert_responses_post_is_documented(openapi: dict[str, JsonValue]) -> None:
post: dict[str, JsonValue] = object_value(object_value(object_value(openapi["paths"])["/v1/responses"])["post"])
body: dict[str, JsonValue] = object_value(post["requestBody"])
schema: dict[str, JsonValue] = object_value(
object_value(object_value(body["content"])["application/json"])["schema"]
)
properties: dict[str, JsonValue] = object_value(schema.get("properties"))
assert "model" in properties and "input" in properties, schema
ok: dict[str, JsonValue] = object_value(object_value(object_value(post)["responses"])["200"])
assert "schema" in object_value(object_value(ok["content"])["application/json"]), ok
def test_v1_responses_post_declares_a_request_body_and_response_schema(gateway: Gateway) -> None:
pytest.skip("BUG: POST /v1/responses takes a raw Request, so /openapi.json documents no body or response schema")
openapi: dict[str, JsonValue] = gateway.get("/openapi.json")
_assert_responses_post_is_documented(openapi)