feat(adapters): from_jsonschema single-endpoint adapter + shared forwarding core

- src/adapters/forward.rs: shared HTTP forwarding core (extracted from
  old from_openapi) — HttpServiceConfig/HttpAuthScheme, build_request
  with capabilities-based credential injection (no env vars), forward
  + forward_stream (SSE projection), parse_sse_frames
- src/adapters/from_jsonschema.rs: FromJsonSchema OperationAdapter
  (ADR-066) — one registration per call, FromJsonSchema provenance
  (leaf, Internal default), Sub -> HandlerKind::Stream (text/event-stream)
- adapted to alkcall 0.1.1: OperationType::Sub, alkcall::client
  adapter traits

Verified: cargo test (106 lib tests), clippy -D warnings, fmt.
This commit is contained in:
2026-08-28 13:43:35 +00:00
parent 4ba9b652b3
commit ad975408e7
4 changed files with 971 additions and 5 deletions
+27 -5
View File
@@ -1,7 +1,7 @@
---
id: adapter-from-jsonschema
name: from_jsonschema single-endpoint adapter
status: pending
status: completed
depends_on: [client-http-host]
scope: narrow
risk: low
@@ -23,9 +23,9 @@ from_openapi.
## Acceptance Criteria
- [ ] Adapter ported; one registration per call, correct provenance
- [ ] Forwarding round-trip test against a local mock server
- [ ] `cargo test` passes
- [x] Adapter ported; one registration per call, correct provenance
- [x] Forwarding round-trip test against a local mock server
- [x] `cargo test` passes
## References
@@ -39,4 +39,26 @@ from_openapi.
## Summary
> Agent fills on completion.
Ported `src/adapters/from_jsonschema.rs` per ADR-066, plus the shared
forwarding core it depends on:
- `src/adapters/forward.rs`: extracted from old from_openapi —
HttpServiceConfig/HttpAuthScheme, build_request (path templates,
query split, body key, credential injection from
OperationContext.capabilities), forward (2xx -> JSON/text/bytes
envelope; non-2xx -> declared code or HTTP_<status>), forward_stream
(SSE -> ResponseEnvelope stream, ADR-049), parse_sse_frames.
Pre-positions the from_openapi port to reuse the same core.
- `src/adapters/from_jsonschema.rs`: FromJsonSchema OperationAdapter —
one HandlerRegistration per call (spec + path template + method),
FromJsonSchema provenance (leaf, composition_authority None,
scoped_env None, Internal default), Sub op type -> HandlerKind::Stream
expecting text/event-stream.
Adaptations for alkcall 0.1.1: OperationType::Sub (not Subscription),
adapter imports via alkcall::client::{AdapterError, OperationAdapter}.
11 tests: registration shape, handler kinds (Query/Sub/Mutation),
build_request bearer-from-capabilities + path/query split, forwarding
round-trip vs local mock server (200/404/500), SSE subscription stream,
no-env-vars invariant. 106 lib tests green.