smithy
smithy copied to clipboard
Protocols that support the `http` trait do not enforce that it must be attached to all operation shapes
As far as I'm aware, all protocols that support the http
binding trait need to have it attached to all their operation
shapes, which are routable using the required http.uri
member.
(Aside: the above is not explicitly stated in the protocols' documentation pages)
However, the following model is accepted by Smithy (it's accepted with restJson
too):
$version: "2.0"
namespace com.amazonaws.simple
use aws.protocols#restXml
@restXml
service SimpleService {
version: "2022-01-01",
operations: [
SimpleOperation,
],
}
//@http(uri: "/simple-operation", method: "GET")
operation SimpleOperation {
output: SimpleOperationOutput,
}
structure SimpleOperationOutput {
@required
requiredString: String,
}
The validation we do now on this is that if any operation in a service uses HTTP bindings, then all of them should. There's no validation that enforces all operations use HTTP bindings though, which is why the above model doesn't fail validation (validator). I think expanding this to cover protocols that use the http
trait makes sense.