Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServerTransport ability to support Vapor's RoutesBuilder HTTPBodyStreamStrategy parameter. #360

Closed
alex1704 opened this issue Nov 4, 2023 · 4 comments

Comments

@alex1704
Copy link

alex1704 commented Nov 4, 2023

Hi,
I'm using VaporTransport and my goal is to manipulate Vapor's RoutesBuilder's body param in signature:

extension RoutesBuilder {
  public func on<Response>(
        _ method: HTTPMethod,
        _ path: [PathComponent],
        body: HTTPBodyStreamStrategy = .collect,
        use closure: @Sendable @escaping (Request) async throws -> Response
    ) -> Route

Implementation of VaporTransport:

extension VaporTransport: ServerTransport {
  public func register(
        _ handler: @Sendable @escaping (
            HTTPTypes.HTTPRequest, OpenAPIRuntime.HTTPBody?, OpenAPIRuntime.ServerRequestMetadata
        ) async throws -> (HTTPTypes.HTTPResponse, OpenAPIRuntime.HTTPBody?),
        method: HTTPRequest.Method,
        path: String
    ) throws {
        self.routesBuilder.on(
            HTTPMethod(method),
            [PathComponent](path)
        )...

Are there any plans to extend ServerTransport protocol to accomplish this goal?

@czechboy0
Copy link
Collaborator

Hi @alex1704, that transport is owned by the Vapor team, so please open an issue on that repo (swift-server/swift-openapi-vapor). But I think they're just waiting for final fixes in Vapor before enabling request streaming. Tim and @MahdiBM can speak more to this.

@czechboy0 czechboy0 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2023
@MahdiBM
Copy link
Contributor

MahdiBM commented Nov 5, 2023

@alex1704 as @czechboy0 mentioned, we're waiting on a fix to be able to properly enable streaming.
I haven't fully investigated it but i'll create an issue about being able to configure that parameter in the Vapor transport. When the fix is there, i'll look into the issue as well.

@czechboy0
Copy link
Collaborator

@MahdiBM I don't think it should be a parameter, streaming should always be enabled, that's what all 3 other transports do. But yes it can only be enabled once Vapor isn't crashing when it's enabled, so let's hold off.

@czechboy0
Copy link
Collaborator

Waiting on vapor/vapor#3096

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

No branches or pull requests

3 participants