Skip to content

Commit

Permalink
Emit DANGER event for DELETE with a payload
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mtdowling committed Sep 15, 2020
1 parent 41daa48 commit 67377b7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public final class HttpMethodSemanticsValidator extends AbstractValidator {
"OPTIONS", new HttpMethodSemantics(true, false, false),
"TRACE", new HttpMethodSemantics(true, false, false),
"POST", new HttpMethodSemantics(false, null, true),
"DELETE", new HttpMethodSemantics(false, true, true),
"DELETE", new HttpMethodSemantics(false, true, false),
"PUT", new HttpMethodSemantics(false, true, true),
"PATCH", new HttpMethodSemantics(false, false, true));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[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
[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
[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
[WARNING] ns.foo#G: This operation uses the `POST` method in the `http` trait, but is marked with the readonly trait | HttpMethodSemantics
[WARNING] ns.foo#H: This operation uses the `DELETE` method in the `http` trait, but is not marked with the idempotent trait | HttpMethodSemantics
[WARNING] ns.foo#I: This operation uses the `GET` method in the `http` trait, but is not marked with the readonly trait | HttpMethodSemantics
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,27 @@
}
}
}
},
"ns.foo#M": {
"type": "operation",
"input": {
"target": "ns.foo#MInput"
},
"traits": {
"smithy.api#http": {
"method": "DELETE",
"uri": "/M"
},
"smithy.api#idempotent": {}
}
},
"ns.foo#MInput": {
"type": "structure",
"members": {
"payload": {
"target": "smithy.api#String"
}
}
}
}
}

0 comments on commit 67377b7

Please sign in to comment.