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][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param base_url: str [Required]#

The base URL of the operation.

param description: str | None [Required]#

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: APIRequestBody | None [Required]#

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:
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

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

type_ (str | Type | tuple | None | Enum)

Return type:

str

to_typescript() str[source]#

Get typescript string representation of the operation.

Return type:

str

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