Skip to content

Conversation

@drganjoo
Copy link
Contributor

@drganjoo drganjoo commented Nov 2, 2025

This commit introduces comprehensive http-1x support to the server code generator,
enabling generation of server SDKs that work with either [email protected] or [email protected]
based on the http-1x codegen flag.

Key Changes

New Infrastructure

  • HttpDependencies.kt: New data class that ensures cohesive HTTP dependency
    selection, preventing accidental mixing of HTTP 0.x and 1.x versions. Provides
    helper methods for accessing HTTP types (Request, Response, HeaderMap, etc.)

  • MultiVersionTestFailure.kt: Test infrastructure for tracking failures by
    HTTP version, enabling tests to run against both http@0 and http@1

ServerCodegenConfig Updates

  • Add http1x boolean field to control HTTP version selection (config key: http-1x)
  • Defaults to false ([email protected])

ServerCodegenContext Updates

  • Add isHttp1() method to check if http-1x is enabled
  • Add httpDependencies() method to provide version-appropriate HTTP dependencies
    throughout code generation

ServerRequiredCustomizations

  • Update to create and manage HttpDependencies based on http-1x setting
  • For http@0: use aws-smithy-legacy-http-server
  • For http@1: use aws-smithy-http-server

Protocol & Test Generator Updates

  • ServerProtocolTestGenerator: Support running protocol tests against both
    HTTP versions, with configurable test runtime mode (AS_CONFIGURED, BOTH, etc.)
  • ServerHttpBoundProtocolGenerator: Use HttpDependencies for all HTTP type
    references instead of hardcoded dependencies

Generator Updates

Updated generators to use HttpDependencies for type resolution:

  • ServerRootGenerator: Use httpDeps for dependency selection
  • ServerServiceGenerator: Pass HttpDependencies to child generators
  • ServerHttpSensitivityGenerator: Use httpDeps for HTTP types
  • ServerOperationGenerator, ServerBuilderGenerator: Use contextual HTTP deps

Test Infrastructure

  • ServerCodegenIntegrationTest: Add multi-version test support with
    ability to run tests against both HTTP versions
  • Http1xDependencyTest: New test validating correct dependency selection
    based on http-1x flag
  • Update existing tests to work with multi-version infrastructure

Core Changes

  • HttpBindingGenerator: Accept HttpDependencies parameter for version-appropriate
    type generation
  • EventStream generators: Use contextual HTTP dependencies
  • SmithyTypesPubUseExtra: Conditional imports based on HTTP version

Testing

All protocol tests can now run against both HTTP versions to ensure compatibility.
Tests track failures by HTTP version for easier debugging.

Relates to #3362

@drganjoo drganjoo requested review from a team as code owners November 2, 2025 20:12
Comment on lines 83 to 84
val httpDeps = HttpDependencies.create(settings.codegenConfig.http1x, rustSymbolProviderConfig.runtimeConfig)
EventStreamSymbolProvider(rustSymbolProviderConfig.runtimeConfig, it, CodegenTarget.SERVER, httpDeps.smithyHttp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend that we actually make RuntimeConfig "do the right thing". Or make it so that you MUST pass an http version setting when getting the dependencies that depend on it.

You could incorporate the http1x setting into RuntimeConfig potentially, then make things like smithyHttp http version aware?

I'm worried that the way the code works right now will be somewhat confusing for folks to deal with and create these really confusing compilation errors.

)
}
if (hasStreamingOperations(model, codegenContext.serviceShape)) {
println("[ServerRequiredCustomizations.pubUseSmithyPrimitivesHttp0x] Adding rt-tokio with http-body-0-4-x")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you want to leave these printlns?

class StatusCodeSensitivity(private val sensitive: Boolean, private val smithyHttpServer: RuntimeType) {
private val codegenScope =
arrayOf(
"SmithyHttpServer" to ServerCargoDependency.smithyHttpServer(runtimeConfig).toType(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably have ServerCargoDependency.smithyHttpServerAuto that automatically gives you the right one. I think the http version would actually fit pretty naturally into RuntimeConfig as an optional parameter.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if you just want to ship things like it is, I get that. I'm just kinda worried about the long term fallout of having it be non-centralized especially as we eventually try to get rid of the old codegen settings.

Fahad Zubair and others added 27 commits December 2, 2025 10:16
Merge the latest main to the `feature/http-1.x` branch, plus replace
http-0.x constructs with http-1.x constructs as described in [Tips for
merging to
feature/http-1.x](#4384)

- CI: ignore server related failures and semver hazard failure (the type
being complained about `Uri` isn't exposed since its enclosing module
`request` isn't exposed as pub, which confuses the semver hazard check)

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: Landon James <[email protected]>
Co-authored-by: Russell Cohen <[email protected]>
Co-authored-by: AWS SDK Rust Bot <[email protected]>
Co-authored-by: AWS SDK Rust Bot <[email protected]>
Co-authored-by: vcjana <[email protected]>
Co-authored-by: Jason Gin <[email protected]>
Co-authored-by: Aaron Todd <[email protected]>
## Motivation and Context
Merge the main branch to the `feature/http-1.x` branch. It takes all
from the main branch except for
[this](#4392 (comment)),
which is replaced by `http-1.x` construct.


----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
@drganjoo drganjoo force-pushed the fahadzub/http-1.x-codegen branch from 5c29232 to 9bb8f0d Compare December 3, 2025 14:07
Fahad Zubair and others added 6 commits December 3, 2025 14:20
This file was accidentally modified in this branch. Reverting to the
upstream version to avoid merge conflicts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
This file was accidentally modified in this branch. Reverting to the
upstream version to avoid merge conflicts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants