Skip to content

Commit 67377b7

Browse files
committed
Emit DANGER event for DELETE with a payload
Lots of clients don't support DELETE with a payload, and the spec calls it out as having no defined semantics. The newly added event can be suppressed if necessary, but this action functions as a way of essentially "signing-off" on the risks associated with using a DELETE with a payload.
1 parent 41daa48 commit 67377b7

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HttpMethodSemanticsValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public final class HttpMethodSemanticsValidator extends AbstractValidator {
5757
"OPTIONS", new HttpMethodSemantics(true, false, false),
5858
"TRACE", new HttpMethodSemantics(true, false, false),
5959
"POST", new HttpMethodSemantics(false, null, true),
60-
"DELETE", new HttpMethodSemantics(false, true, true),
60+
"DELETE", new HttpMethodSemantics(false, true, false),
6161
"PUT", new HttpMethodSemantics(false, true, true),
6262
"PATCH", new HttpMethodSemantics(false, false, true));
6363

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[DANGER] ns.foo#K: This operation uses the `GET` method in the `http` trait, but has the following members bound to the payload: `payload` | HttpMethodSemantics
22
[DANGER] ns.foo#L: This operation uses the `GET` method in the `http` trait, but has the following members bound to the document: `payload` | HttpMethodSemantics
3+
[DANGER] ns.foo#M: This operation uses the `DELETE` method in the `http` trait, but has the following members bound to the document: `payload` | HttpMethodSemantics
34
[WARNING] ns.foo#G: This operation uses the `POST` method in the `http` trait, but is marked with the readonly trait | HttpMethodSemantics
45
[WARNING] ns.foo#H: This operation uses the `DELETE` method in the `http` trait, but is not marked with the idempotent trait | HttpMethodSemantics
56
[WARNING] ns.foo#I: This operation uses the `GET` method in the `http` trait, but is not marked with the readonly trait | HttpMethodSemantics

smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/validators/http-method-semantics-validator.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,27 @@
151151
}
152152
}
153153
}
154+
},
155+
"ns.foo#M": {
156+
"type": "operation",
157+
"input": {
158+
"target": "ns.foo#MInput"
159+
},
160+
"traits": {
161+
"smithy.api#http": {
162+
"method": "DELETE",
163+
"uri": "/M"
164+
},
165+
"smithy.api#idempotent": {}
166+
}
167+
},
168+
"ns.foo#MInput": {
169+
"type": "structure",
170+
"members": {
171+
"payload": {
172+
"target": "smithy.api#String"
173+
}
174+
}
154175
}
155176
}
156177
}

0 commit comments

Comments
 (0)