Module openapi

Module openapi 

Source
Expand description

OpenAPI 3.x introspection adapter — resolves operations from an OpenAPI spec and delegates to RestApiAdapter OpenAPI 3.x introspection adapter.

Implements crate::ports::ScrapingService for any API backed by an OpenAPI 3.x specification (JSON or YAML). At runtime the adapter:

  1. Fetches and parses the spec, caching it for the lifetime of the adapter.
  2. Resolves the target operation by operationId or "METHOD /path".
  3. Binds params.args to path parameters, query parameters, and request body.
  4. Delegates the concrete HTTP call to the inner crate::adapters::rest_api::RestApiAdapter.

An optional proactive rate limit (params.rate_limit) is enforced before each request; reactive 429 handling is inherited from crate::adapters::rest_api::RestApiAdapter.

§ServiceInput contract

FieldTypeDescription
urlstringURL of the OpenAPI spec (JSON or YAML)
params.operationstringoperationId or "METHOD /path"
params.argsobjectPath / query / body args (merged)
params.authobjectSame shape as crate::adapters::rest_api::RestApiAdapter
params.server.urlstringOverride the spec’s servers[0].url
params.rate_limitobjectOptional proactive throttle

§Example

use stygian_graph::adapters::openapi::OpenApiAdapter;
use stygian_graph::ports::{ScrapingService, ServiceInput};
use serde_json::json;

let adapter = OpenApiAdapter::new();

let input = ServiceInput {
    url: "https://petstore3.swagger.io/api/v3/openapi.json".to_string(),
    params: json!({
        "operation": "listPets",
        "args": { "status": "available" },
        "auth": { "type": "api_key_header", "header": "api_key", "key": "special-key" },
    }),
};
// let output = adapter.execute(input).await.unwrap();

Structs§

OpenApiAdapter
OpenAPI 3.x introspection adapter.
OpenApiConfig
Configuration for OpenApiAdapter.