smithy icon indicating copy to clipboard operation
smithy copied to clipboard

URI conflict validation is too constraining

Open Baccata opened this issue 3 years ago • 7 comments

Minimised repro

namespace foo

service Foo {
  operations: [Hello1, Hello2]
}

structure Hello1Input {
  @httpLabel
  @required
  name: String,
}

@http(method: "GET", uri: "/hello")
@readonly
operation Hello2 {
}

@http(method: "GET", uri: "/{name}/greet")
operation Hello1 {
  input: Hello1Input,
}

Gives the following errors :

Screenshot 2021-12-27 at 12 06 39

Expected behaviour :

These two URI paths should not be presenting a conflict, as there is always a possibility to distinguish between one and the other without additional informations.

I believe the cause of the problem is this condition which rakes too widely.

Baccata avatar Dec 27 '21 11:12 Baccata

Yes, it is too constraining in several ways. We have a few proposals to make URI conflict resolution more flexible. I’m hoping we can finish those up and publish an RFC soon.

mtdowling avatar Dec 29 '21 16:12 mtdowling

Is that RFC ready?

david-perez avatar Jun 22 '22 17:06 david-perez

Bumped into this whilst trying to smithy-translate an API...

Quafadas avatar Nov 22 '22 18:11 Quafadas

Another example from today:

GET /subscriptions/{id}
GET /subscriptions/device/{deviceId}

these shouldn't be conflicting as {id} isn't a greedy label. Is there any chance we can update this soon?

kubukoz avatar Nov 23 '22 15:11 kubukoz

We are aware that the rule is too restrictive and we are planning to publish an RFC in the coming weeks to allow these and URIs that might conflict at runtime by specifying how the conflicts should be resolved by using the most specific URI, similar to what API Gateway does.

I will update this issue when the RFC is publish to get early feedback and make sure that the proposal covers your use cases.

sugmanue avatar Nov 29 '22 18:11 sugmanue

I have opened a draft pull request for our current thinking about how to remove this restriction, if you have time we will appreciate your feedback on this proposal

sugmanue avatar Dec 14 '22 21:12 sugmanue

Hey, I saw the pr about uri conflict resolution has been merged, yay 🎉!

Just wonder do We have any roadmap/plan to make it into smithy specification soon? thanks!

lenguyenthanh avatar Apr 23 '24 04:04 lenguyenthanh

The RFC has been merged and the implemented in Smithy, see the updated docs here. Apologies for the late notice, I forgot about updating this thread.

sugmanue avatar Jul 11 '24 16:07 sugmanue