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:
- Fetches and parses the spec, caching it for the lifetime of the adapter.
- Resolves the target operation by
operationIdor"METHOD /path". - Binds
params.argsto path parameters, query parameters, and request body. - 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
| Field | Type | Description |
|---|---|---|
url | string | URL of the OpenAPI spec (JSON or YAML) |
params.operation | string | operationId or "METHOD /path" |
params.args | object | Path / query / body args (merged) |
params.auth | object | Same shape as crate::adapters::rest_api::RestApiAdapter |
params.server.url | string | Override the spec’s servers[0].url |
params.rate_limit | object | Optional 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§
- Open
ApiAdapter - OpenAPI 3.x introspection adapter.
- Open
ApiConfig - Configuration for
OpenApiAdapter.