smithy4s icon indicating copy to clipboard operation
smithy4s copied to clipboard

Incorrect routing when the URL differs by a static query param only

Open msosnicki opened this issue 1 year ago • 2 comments

The example below, while is a valid smithy, fails to be routed correctly by smithy4s. The routing mechanism uses a combination of HTTP method and path, where path is just a part without query params. As a result, one of these endpoint will be receiving both types of requests.

$version: "2"

namespace example

use alloy#simpleRestJson

@simpleRestJson
service ExampleService {
  version: "1.0.0",
  operations: [GetQuery, GetQueryStatic]
}

@http(method: "GET", uri: "/get-query")
operation GetQuery {
}

@http(method: "GET", uri: "/get-query?static")
operation GetQueryStatic {
}

msosnicki avatar Nov 08 '24 06:11 msosnicki

mmm interesting. We need to define some form of ordering of uri patterns.

Baccata avatar Dec 03 '24 09:12 Baccata

for ordering, #1567 - https://smithy.io/2.0/spec/http-bindings.html#specificity-routing Example 2 shows what to do when ? is present.

worth noting, we do seemingly support static query params (HttpEndpoint has staticQueryParams, which I didn't know).


so maybe this is just a dupe of #1567 after all?

kubukoz avatar Dec 03 '24 15:12 kubukoz

Closed in #1743, specificity will be closed in #1766

kubukoz avatar Jul 04 '25 15:07 kubukoz