Skip to main content

type_dict_to_json.py

Source: sunholo/vertex/type_dict_to_json.py

Functions

describe_typed_dict(typed_dict_cls: Any, descriptions: Dict[str, str]) -> Dict[str, Any]

Generate a dictionary with field descriptions.

Parameters:

  • typed_dict_cls: The TypedDict class.
  • descriptions: The dictionary containing field descriptions.

Returns:

  • A dictionary with field descriptions.

is_typed_dict(cls)

Check if a class is a TypedDict.

openapi_to_typed_dict(openapi_spec: Dict[str, Any], schema_name: str) -> Any

Convert an OpenAPI schema to a TypedDict dynamically.

Parameters:

  • openapi_spec: The OpenAPI specification.
  • schema_name: The name of the schema to convert.

Returns:

  • A dynamically created TypedDict class and field descriptions.

resolve_ref(openapi_spec: Dict[str, Any], ref: str) -> Dict[str, Any]

Resolve a $ref in the OpenAPI spec.

Parameters:

  • openapi_spec: The OpenAPI specification.
  • ref: The reference string.

Returns:

  • The resolved schema.
Sunholo Multivac

Get in touch to see if we can help with your GenAI project.

Contact us

Other Links

Sunholo Multivac - GenAIOps

Copyright ©

Holosun ApS 2024