langchain_community.tools.openapi.utils.api_models.APIOperation¶

class langchain_community.tools.openapi.utils.api_models.APIOperation[source]¶

Bases: BaseModel

A model for a single API operation.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param base_url: str [Required]¶

The base URL of the operation.

param description: Optional[str] = None¶

The description of the operation.

param method: HTTPVerb [Required]¶

The HTTP method of the operation.

param operation_id: str [Required]¶

The unique identifier of the operation.

param path: str [Required]¶

The path of the operation.

param properties: Sequence[APIProperty] [Required]¶
param request_body: Optional[APIRequestBody] = None¶

The request body of the operation.

classmethod from_openapi_spec(spec: OpenAPISpec, path: str, method: str) APIOperation[source]¶

Create an APIOperation from an OpenAPI spec.

Parameters
  • spec (OpenAPISpec) –

  • path (str) –

  • method (str) –

Return type

APIOperation

classmethod from_openapi_url(spec_url: str, path: str, method: str) APIOperation[source]¶

Create an APIOperation from an OpenAPI URL.

Parameters
  • spec_url (str) –

  • path (str) –

  • method (str) –

Return type

APIOperation

to_typescript() str[source]¶

Get typescript string representation of the operation.

Return type

str

static ts_type_from_python(type_: Union[str, Type, tuple, None, Enum]) str[source]¶
Parameters

type_ (Union[str, Type, tuple, None, Enum]) –

Return type

str

property body_params: List[str]¶
property path_params: List[str]¶
property query_params: List[str]¶