Skip to content

Commit

Permalink
Update httpContentMd5 impl for breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kstich committed Apr 20, 2020
1 parent bf0ee06 commit 964b9aa
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
27 changes: 27 additions & 0 deletions docs/source/spec/aws/aws-restxml-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,31 @@ See
}
}


.. _aws.protocols#httpContentMd5-trait:

--------------------------------------
``aws.protocols#httpContentMd5`` trait
--------------------------------------

Summary
Indicates that an operation requires the Content-MD5 header set in its HTTP
request.
Trait selector
``operation``
Value type
Annotation trait.
See
:rfc:`1864`

.. tabs::

.. code-tab:: smithy

@httpContentMd5
operation PutSomething {
input: PutSomethingInput,
output: PutSomethingOutput
}

*TODO: Add specifications, protocol examples, etc.*
4 changes: 2 additions & 2 deletions docs/source/spec/core/behavior-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Conflicts with
.. code-tab:: smithy

@idempotent
operation GetSomething {
input: DeleteSomething,
operation DeleteSomething {
input: DeleteSomethingInput,
output: DeleteSomethingOutput
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand All @@ -15,26 +15,27 @@

package software.amazon.smithy.aws.traits.protocols;

import software.amazon.smithy.model.SourceLocation;
import software.amazon.smithy.model.node.Node;
import software.amazon.smithy.model.node.ObjectNode;
import software.amazon.smithy.model.shapes.ShapeId;
import software.amazon.smithy.model.traits.BooleanTrait;
import software.amazon.smithy.model.traits.AnnotationTrait;

/**
* Indicates that the operation requires Content-MD5 header in its
* HTTP request.
*/
public final class HttpContentMd5Trait extends BooleanTrait {
public final class HttpContentMd5Trait extends AnnotationTrait {
public static final ShapeId ID = ShapeId.from("aws.protocols#httpContentMd5");

public HttpContentMd5Trait(SourceLocation sourceLocation) {
super(ID, sourceLocation);
public HttpContentMd5Trait(ObjectNode node) {
super(ID, node);
}

public HttpContentMd5Trait() {
this(SourceLocation.NONE);
this(Node.objectNode());
}

public static final class Provider extends BooleanTrait.Provider<HttpContentMd5Trait> {
public static final class Provider extends AnnotationTrait.Provider<HttpContentMd5Trait> {
public Provider() {
super(ID, HttpContentMd5Trait::new);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
"smithy.api#trait": {
"selector": "operation"
},
"smithy.api#documentation": "Defines if an operation requires Content-MD5 header set in its HTTP request"
"smithy.api#documentation": "Defines if an operation requires the Content-MD5 header set in its HTTP request"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"target": "ns.foo#Output"
},
"traits": {
"aws.protocols#httpContentMd5": true
"aws.protocols#httpContentMd5": {}
}
},
"ns.foo#Input": {
Expand Down Expand Up @@ -49,7 +49,7 @@
}
},
"traits": {
"aws.protocols#httpContentMd5": true
"aws.protocols#httpContentMd5": {}
}
},
"ns.foo#InvalidOutput": {
Expand All @@ -60,7 +60,7 @@
}
},
"traits": {
"aws.protocols#httpContentMd5": true
"aws.protocols#httpContentMd5": {}
}
},
"ns.foo#InvalidError": {
Expand All @@ -72,7 +72,7 @@
},
"traits": {
"smithy.api#error": "client",
"aws.protocols#httpContentMd5": true
"aws.protocols#httpContentMd5": {}
}
},
"ns.foo#InvalidStructure": {
Expand All @@ -81,7 +81,7 @@
"Body": {
"target": "smithy.api#Blob",
"traits": {
"aws.protocols#httpContentMd5": true
"aws.protocols#httpContentMd5": {}
}
}
}
Expand Down

0 comments on commit 964b9aa

Please sign in to comment.