Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-introduce errors for dangerous set value types #1224

Merged
merged 2 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions docs/source/1.0/spec/core/constraint-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -608,15 +608,13 @@ in a response.

.. warning::

This trait has been deprecated. It will be removed in future versions
of Smithy. Set shapes should be used instead.
This trait has been deprecated and will be removed in future versions of
Smithy. Set shapes should be used instead.

Summary
Indicates that the items in a :ref:`list` MUST be unique.
Trait selector
``:test(list > member > simpleType)``

*A list that targets any simple type.*
``:test(list > member > :test(string, blob, byte, short, integer, long, bigDecimal, bigInteger))``
Value type
Annotation trait.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,10 @@ private Optional<ValidationEvent> validateSetMember(Shape shape, ShapeId target,
}

if (!VALID_SET_TARGETS.contains(targetShape.getType())) {
return Optional.of(warning(shape, format(
return Optional.of(error(shape, format(
"Set member targets %s, but sets can target only %s. You can model a collection of %s shapes "
+ "by changing this shape to a list. Modeling a set of values of other types is problematic "
+ "to support across a wide range of programming languages. This will be upgraded to an ERROR "
+ "in a future release.",
+ "to support across a wide range of programming languages.",
targetShape,
VALID_SET_TARGETS.stream().map(ShapeType::toString).sorted().collect(Collectors.joining(", ")),
targetShape.getType())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ structure recommended {
structure sparse {}

/// Indicates that the items in a list MUST be unique.
@trait(selector: "list")
@trait(selector: ":test(list > member > :test(string, blob, byte, short, integer, long, bigDecimal, bigInteger))")
@deprecated(message: "The uniqueItems trait has been deprecated in favor of using sets.", since: "2.0")
structure uniqueItems {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[WARNING] smithy.example#TimestampSet: Set member targets (timestamp: `smithy.api#Timestamp`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of timestamp shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. This will be upgraded to an ERROR in a future release. | Target
[WARNING] smithy.example#BooleanSet: Set member targets (boolean: `smithy.api#Boolean`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of boolean shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. This will be upgraded to an ERROR in a future release. | Target
[WARNING] smithy.example#DoubleSet: Set member targets (double: `smithy.api#Double`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of double shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. This will be upgraded to an ERROR in a future release. | Target
[WARNING] smithy.example#FloatSet: Set member targets (float: `smithy.api#Float`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of float shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. This will be upgraded to an ERROR in a future release. | Target
[WARNING] smithy.example#DocumentSet: Set member targets (document: `smithy.api#Document`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of document shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. This will be upgraded to an ERROR in a future release. | Target
[WARNING] smithy.example#ListSet: Set member targets (list: `smithy.example#StringList`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of list shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. This will be upgraded to an ERROR in a future release. | Target
[WARNING] smithy.example#SetSet: Set member targets (set: `smithy.example#StringSet`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of set shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. This will be upgraded to an ERROR in a future release. | Target
[WARNING] smithy.example#MapSet: Set member targets (map: `smithy.example#StringMap`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of map shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. This will be upgraded to an ERROR in a future release. | Target
[WARNING] smithy.example#StructSet: Set member targets (structure: `smithy.example#StructureExample`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of structure shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. This will be upgraded to an ERROR in a future release. | Target
[WARNING] smithy.example#UnionSet: Set member targets (union: `smithy.example#UnionExample`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of union shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. This will be upgraded to an ERROR in a future release. | Target
[ERROR] smithy.example#TimestampSet: Set member targets (timestamp: `smithy.api#Timestamp`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of timestamp shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. | Target
[ERROR] smithy.example#BooleanSet: Set member targets (boolean: `smithy.api#Boolean`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of boolean shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. | Target
[ERROR] smithy.example#DoubleSet: Set member targets (double: `smithy.api#Double`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of double shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. | Target
[ERROR] smithy.example#FloatSet: Set member targets (float: `smithy.api#Float`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of float shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. | Target
[ERROR] smithy.example#DocumentSet: Set member targets (document: `smithy.api#Document`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of document shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. | Target
[ERROR] smithy.example#ListSet: Set member targets (list: `smithy.example#StringList`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of list shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. | Target
[ERROR] smithy.example#SetSet: Set member targets (set: `smithy.example#StringSet`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of set shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. | Target
[ERROR] smithy.example#MapSet: Set member targets (map: `smithy.example#StringMap`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of map shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. | Target
[ERROR] smithy.example#StructSet: Set member targets (structure: `smithy.example#StructureExample`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of structure shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. | Target
[ERROR] smithy.example#UnionSet: Set member targets (union: `smithy.example#UnionExample`), but sets can target only bigDecimal, bigInteger, blob, byte, integer, long, short, string. You can model a collection of union shapes by changing this shape to a list. Modeling a set of values of other types is problematic to support across a wide range of programming languages. | Target
[ERROR] smithy.example#StreamingBlobSet: Set member targets (blob: `smithy.example#StreamingBlob`), a shape marked with the @streaming trait. | Target
[ERROR] smithy.example#StreamingStringSet: Set member targets (string: `smithy.example#StreamingString`), a shape marked with the @streaming trait. | Target