Home / Function/ openapi_dumps() — anthropic-sdk-python Function Reference

openapi_dumps() — anthropic-sdk-python Function Reference

Architecture documentation for the openapi_dumps() function in _json.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  9576481d_8751_20e1_4f0f_581a6c7266ac["openapi_dumps()"]
  add5a69b_d84f_deef_9958_765008080340["_json.py"]
  9576481d_8751_20e1_4f0f_581a6c7266ac -->|defined in| add5a69b_d84f_deef_9958_765008080340
  style 9576481d_8751_20e1_4f0f_581a6c7266ac fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_utils/_json.py lines 11–25

def openapi_dumps(obj: Any) -> bytes:
    """
    Serialize an object to UTF-8 encoded JSON bytes.

    Extends the standard json.dumps with support for additional types
    commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc.
    """
    return json.dumps(
        obj,
        cls=_CustomEncoder,
        # Uses the same defaults as httpx's JSON serialization
        ensure_ascii=False,
        separators=(",", ":"),
        allow_nan=False,
    ).encode()

Subdomains

Frequently Asked Questions

What does openapi_dumps() do?
openapi_dumps() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_utils/_json.py.
Where is openapi_dumps() defined?
openapi_dumps() is defined in src/anthropic/_utils/_json.py at line 11.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free