Skip to content

Canonicalize/un-canonicalize request path and location values at the server/client stream-factory boundary #2145

Closed

Description

@jfallows

Context

Follow-up to #2113 / PR #2128. Stages 1-2 of that work (merged) established:

  • options.specs.<name>.server is a singular, connection-only override that exists solely on server/client-kind bindings (binding-openapi, binding-asyncapi) — never on proxy-kind bindings, which hold no real connection.
  • when.servers/when.tag are pure, portable route-selection conditions that match against each spec's own literal declared values (OpenapiServerView.literalUrl / AsyncapiServerView.literalHost/literalUrl), decoupled from whatever deployment override is configured — available uniformly across server, client, and proxy kinds.

This closed the abstraction leak in options.* and route-condition config. What remains out of scope for that PR is the deeper, runtime-stream-handler-level leak identified during design discussion:

In the pipeline openapi server -> openapi-asyncapi proxy -> asyncapi client (and symmetrically for openapi client, and for asyncapi server/client/proxy), when openapi server has options.specs.*.server configured for a spec with a path prefix, the decoded HTTP request carries the connection-oriented :scheme/:authority/:path (including that path prefix) as an embedded OpenapiBeginEx → HttpBeginEx extension. openapi-asyncapi then needs to route via the generated http_kafka_proxy0 composite binding, whose when.path conditions are baked in path-prefix-aware at generation time. Today this works only because openapi-asyncapi (incorrectly, per Stages 1-2) held its own copy of the connecting binding's server config to reconstruct the same path shape — an abstraction leak, since openapi-asyncapi already has the canonical apiId/operationId and shouldn't need to know anything about how the connecting binding chose to serve requests.

Proposal

Canonicalize the request (strip the deployment-specific server/path shape down to the spec's own canonical form) on the way in at OpenapiServerFactory/AsyncapiServerFactory, and un-canonicalize (reapply the configured server's shape) on the way out at OpenapiClientFactory/AsyncapiClientFactory. Everything in between — openapi-asyncapi proxy, asyncapi proxy (mqtt-kafka/sse-kafka/http-kafka mapping) — would then operate purely in canonical terms (apiId/operationId), with no need to reference options.specs.*.server at all, closing the leak completely.

This is real-time stream-handler work (not just config generation), materially riskier than Stages 1-2, and depends on Stages 1-2 already being in place (a clean, singular server override to canonicalize against). It was deferred from #2128 for that reason.

Scope

  • OpenapiServerFactory / OpenapiClientFactory (runtime/binding-openapi)
  • AsyncapiServerFactory / AsyncapiClientFactory (runtime/binding-asyncapi)
  • Verify openapi-asyncapi's generated http_kafka_proxy0 routing and asyncapi proxy's mqtt-kafka/sse-kafka/http-kafka mapping no longer need any server-shaped config once canonicalization is in place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions