Skip to content

Commit c40a385

Browse files
committed
Remove allowing true for annotation traits
This commit removes the support for setting annotation traits to true because the previous rationale for supporting that no longer holds true. The previous rationale was that supporting `true` makes writing the AST JSON files easier. However, we've already crossed the point where we don't want humans writing the JSON AST, and we want it to be as easy to parse as possible. The AST format now requires that `{}` is provided for annotation traits. The IDL no longer supports setting a trait to `true` or `null`, as that was only supported in order to provide isomorphism with the AST support. We previously didn't persist which model format a pending trait definition came from, so it was necessary to give them the same feature set. However, now the Smithy loader maintains a boolean value that tells the loader whether or not a value is an "annotation", meaning trait with no value. This isn't a feature used in the AST loader, but is used in the IDL loader. Further, the BooleanTrait abstract class was renamed to AnnotationTrait. This is something I wanted to do for a long time, but never did since it would cause so much churn, and the name wasn't that far off from what it represents. However, now that `true` isn't supported for annotation traits, the name BooleanTrait makes no sense. This commit renames it and takes the BC hit because it's now worth it.
1 parent 2106393 commit c40a385

File tree

186 files changed

+857
-853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+857
-853
lines changed

docs/source/spec/aws/amazon-apigateway.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ operation within the service.
429429
"type": "service",
430430
"version": "2018-03-17",
431431
"traits": {
432-
"aws.protocols#restJson1": true,
432+
"aws.protocols#restJson1": {},
433433
"aws.auth#sigv4": {
434434
"name": "weather"
435435
},

docs/source/spec/aws/aws-auth.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Trait value
6666
"type": "service",
6767
"version": "2018-03-17",
6868
"traits": {
69-
"aws.protocols#restJson1": true,
69+
"aws.protocols#restJson1": {},
7070
"aws.api#service": {
7171
"sdkId": "Some Value"
7272
},
@@ -127,7 +127,7 @@ operation MUST NOT be used as part of the request signature calculation:
127127
"target": "smithy.example#PutThingsOutput"
128128
},
129129
"traits": {
130-
"aws.auth#unsignedPayload": true
130+
"aws.auth#unsignedPayload": {}
131131
}
132132
}
133133
}

docs/source/spec/aws/aws-core.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ plane unless an operation or resource is marked with the
773773
"target": "smithy.example#PutThingsOutput"
774774
},
775775
"traits": {
776-
"aws.api#controlPlane": true
776+
"aws.api#controlPlane": {}
777777
}
778778
}
779779
}
@@ -827,7 +827,7 @@ plane unless an operation or resource is marked with the
827827
"target": "smithy.example#PutThingsOutput"
828828
},
829829
"traits": {
830-
"aws.api#dataPlane": true
830+
"aws.api#dataPlane": {}
831831
}
832832
}
833833
}
@@ -1111,8 +1111,8 @@ using an ``clientEndpointDiscoveryId``.
11111111
"Id": {
11121112
"target": "smithy.api#String",
11131113
"traits": {
1114-
"aws.api#clientEndpointDiscoveryId": true,
1115-
"smithy.api#required": true
1114+
"aws.api#clientEndpointDiscoveryId": {},
1115+
"smithy.api#required": {}
11161116
}
11171117
}
11181118
}

docs/source/spec/aws/aws-ec2-query-protocol.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Value type
4949
"type": "service",
5050
"version": "2020-02-05",
5151
"traits": {
52-
"aws.protocols#ec2Query": true
52+
"aws.protocols#ec2Query": {}
5353
}
5454
}
5555
}

docs/source/spec/aws/aws-iam.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ condition key inference disabled.
386386
}
387387
},
388388
"traits": {
389-
"aws.iam#disableConditionKeyInference": true
389+
"aws.iam#disableConditionKeyInference": {}
390390
}
391391
}
392392
}

docs/source/spec/aws/aws-json-1_0-protocol.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ See
5050
"type": "service",
5151
"version": "2020-02-05",
5252
"traits": {
53-
"aws.protocols#awsJson1_0": true
53+
"aws.protocols#awsJson1_0": {}
5454
}
5555
}
5656
}

docs/source/spec/aws/aws-json-1_1-protocol.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ See
5050
"type": "service",
5151
"version": "2020-02-05",
5252
"traits": {
53-
"aws.protocols#awsJson1_1": true
53+
"aws.protocols#awsJson1_1": {}
5454
}
5555
}
5656
}

docs/source/spec/aws/aws-query-protocol.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ See
5050
"type": "service",
5151
"version": "2020-02-05",
5252
"traits": {
53-
"aws.protocols#awsQuery": true
53+
"aws.protocols#awsQuery": {}
5454
}
5555
}
5656
}

docs/source/spec/aws/aws-restjson1-protocol.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The following example defines a service that uses ``aws.protocols#restJson1``.
8282
"type": "service",
8383
"version": "2020-04-02",
8484
"traits": {
85-
"aws.protocols#restJson1": true
85+
"aws.protocols#restJson1": {}
8686
}
8787
}
8888
}

docs/source/spec/aws/aws-restxml-protocol.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ See
5050
"type": "service",
5151
"version": "2020-02-05",
5252
"traits": {
53-
"aws.protocols#restXml": true
53+
"aws.protocols#restXml": {}
5454
}
5555
}
5656
}

docs/source/spec/core/auth-traits.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ The following example defines two operations:
337337
}
338338
],
339339
"traits": {
340-
"smithy.api#httpBasicAuth": true,
341-
"smithy.api#httpDigestAuth": true,
340+
"smithy.api#httpBasicAuth": {},
341+
"smithy.api#httpDigestAuth": {},
342342
"smithy.api#auth": [
343343
"smithy.api#httpBasicAuth"
344344
]

docs/source/spec/core/behavior-traits.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ explicitly on the operation.
277277
"target": "smithy.example#GetFoosOutput"
278278
},
279279
"traits": {
280-
"smithy.api#readonly": true,
281-
"smithy.api#collection": true,
280+
"smithy.api#readonly": {},
281+
"smithy.api#collection": {},
282282
"smithy.api#paginated": {
283283
"inputToken": "nextToken",
284284
"outputToken": "nextToken",
@@ -307,7 +307,7 @@ explicitly on the operation.
307307
"foos": {
308308
"target": "smithy.example#StringList",
309309
"traits": {
310-
"smithy.api#required": true
310+
"smithy.api#required": {}
311311
}
312312
}
313313
}
@@ -373,8 +373,8 @@ settings from a service.
373373
"target": "smithy.example#GetFoosOutput"
374374
},
375375
"traits": {
376-
"smithy.api#readonly": true,
377-
"smithy.api#collection": true,
376+
"smithy.api#readonly": {},
377+
"smithy.api#collection": {},
378378
"smithy.api#paginated": {
379379
"items": "foos"
380380
}
@@ -445,7 +445,7 @@ wrapper where the output token and items are referenced by paths.
445445
"target": "smithy.example#GetFoosOutput"
446446
},
447447
"traits": {
448-
"smithy.api#readonly": true,
448+
"smithy.api#readonly": {},
449449
"smithy.api#paginated": {
450450
"inputToken": "nextToken",
451451
"outputToken": "result.nextToken",
@@ -471,7 +471,7 @@ wrapper where the output token and items are referenced by paths.
471471
"result": {
472472
"target": "smithy.example#ResultWrapper",
473473
"traits": {
474-
"smithy.api#required": true
474+
"smithy.api#required": {}
475475
}
476476
}
477477
}
@@ -485,7 +485,7 @@ wrapper where the output token and items are referenced by paths.
485485
"foos": {
486486
"target": "smithy.example#StringList",
487487
"traits": {
488-
"smithy.api#required": true
488+
"smithy.api#required": {}
489489
}
490490
}
491491
}

docs/source/spec/core/constraint-traits.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ contain a valid shape ID that targets an integer shape in the model.
222222
"smithy.example#integerRef": {
223223
"type": "string",
224224
"traits": {
225-
"smithy.api#trait": true,
225+
"smithy.api#trait": {},
226226
"smithy.api#idRef": {
227227
"failWhenMissing": true,
228228
"selector": "integer"
@@ -547,7 +547,7 @@ in a response.
547547
"foo": {
548548
"target": "smithy.example#FooString",
549549
"traits": {
550-
"smithy.api#required": true
550+
"smithy.api#required": {}
551551
}
552552
}
553553
}
@@ -591,7 +591,7 @@ Value type
591591
"target": "smithy.api#String"
592592
},
593593
"traits": {
594-
"smithy.api#uniqueItems": true
594+
"smithy.api#uniqueItems": {}
595595
}
596596
}
597597
}

docs/source/spec/core/endpoint-traits.rst

+18-18
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The following example defines an operation that uses a custom endpoint:
7979
"target": "smithy.example#GetStatusOutput"
8080
},
8181
"traits": {
82-
"smithy.api#readonly": true,
82+
"smithy.api#readonly": {},
8383
"smithy.api#endpoint": {
8484
"hostPrefix": "{foo}.data."
8585
}
@@ -91,8 +91,8 @@ The following example defines an operation that uses a custom endpoint:
9191
"foo": {
9292
"target": "smithy.api#String",
9393
"traits": {
94-
"smithy.api#required": true,
95-
"smithy.api#hostLabel": true
94+
"smithy.api#required": {},
95+
"smithy.api#hostLabel": {}
9696
}
9797
}
9898
}
@@ -145,7 +145,7 @@ Given the following operation,
145145
"target": "smithy.example#GetStatusOutput"
146146
},
147147
"traits": {
148-
"smithy.api#readonly": true,
148+
"smithy.api#readonly": {},
149149
"smithy.api#endpoint": {
150150
"hostPrefix": "{foo}.data."
151151
}
@@ -157,8 +157,8 @@ Given the following operation,
157157
"foo": {
158158
"target": "smithy.api#String",
159159
"traits": {
160-
"smithy.api#required": true,
161-
"smithy.api#hostLabel": true
160+
"smithy.api#required": {},
161+
"smithy.api#hostLabel": {}
162162
}
163163
}
164164
}
@@ -214,7 +214,7 @@ Given the following operation,
214214
"target": "smithy.example#GetStatusOutput"
215215
},
216216
"traits": {
217-
"smithy.api#readonly": true,
217+
"smithy.api#readonly": {},
218218
"smithy.api#endpoint": {
219219
"hostPrefix": "{foo}-{bar}.data."
220220
}
@@ -226,15 +226,15 @@ Given the following operation,
226226
"foo": {
227227
"target": "smithy.api#String",
228228
"traits": {
229-
"smithy.api#required": true,
230-
"smithy.api#hostLabel": true
229+
"smithy.api#required": {},
230+
"smithy.api#hostLabel": {}
231231
}
232232
},
233233
"bar": {
234234
"target": "smithy.api#String",
235235
"traits": {
236-
"smithy.api#required": true,
237-
"smithy.api#hostLabel": true
236+
"smithy.api#required": {},
237+
"smithy.api#hostLabel": {}
238238
}
239239
}
240240
}
@@ -279,7 +279,7 @@ invalid because the ``{foo}`` and ``{bar}`` labels are adjacent:
279279
"target": "smithy.example#GetStatusOutput"
280280
},
281281
"traits": {
282-
"smithy.api#readonly": true,
282+
"smithy.api#readonly": {},
283283
"smithy.api#endpoint": {
284284
"hostPrefix": "{foo}{bar}.data."
285285
}
@@ -347,7 +347,7 @@ Given the following operation,
347347
"target": "smithy.example#GetStatusOutput"
348348
},
349349
"traits": {
350-
"smithy.api#readonly": true,
350+
"smithy.api#readonly": {},
351351
"smithy.api#endpoint": {
352352
"hostPrefix": "{foo}.data."
353353
},
@@ -363,8 +363,8 @@ Given the following operation,
363363
"foo": {
364364
"target": "smithy.api#String",
365365
"traits": {
366-
"smithy.api#required": true,
367-
"smithy.api#hostLabel": true,
366+
"smithy.api#required": {},
367+
"smithy.api#hostLabel": {},
368368
"smithy.api#httpHeader": "X-Foo"
369369
}
370370
}
@@ -438,7 +438,7 @@ to an operation marked with the :ref:`endpoint-trait` will be ignored.
438438
"target": "smithy.example#GetStatusOutput"
439439
},
440440
"traits": {
441-
"smithy.api#readonly": true,
441+
"smithy.api#readonly": {},
442442
"smithy.api#endpoint": {
443443
"hostPrefix": "{foo}.data."
444444
}
@@ -450,8 +450,8 @@ to an operation marked with the :ref:`endpoint-trait` will be ignored.
450450
"foo": {
451451
"target": "smithy.api#String",
452452
"traits": {
453-
"smithy.api#required": true,
454-
"smithy.api#hostLabel": true
453+
"smithy.api#required": {},
454+
"smithy.api#hostLabel": {}
455455
}
456456
}
457457
}

docs/source/spec/core/http-traits.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ and HTTP bindings:
986986
"messages": {
987987
"target": "smithy.example#MessageStream",
988988
"traits": {
989-
"smithy.api#httpPayload": true
989+
"smithy.api#httpPayload": {}
990990
}
991991
}
992992
}

docs/source/spec/core/intro.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ syntax, similar to:
5959
"foo": {
6060
"target": "smithy.api#String",
6161
"traits": {
62-
"smithy.api#required": true
62+
"smithy.api#required": {}
6363
}
6464
},
6565
"baz": {
6666
"target": "smithy.api#Integer",
6767
"traits": {
68-
"smithy.api#deprecated": true
68+
"smithy.api#deprecated": {}
6969
}
7070
}
7171
}

docs/source/spec/core/json-ast.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ member:
337337
"stringMember": {
338338
"target": "smithy.api#String",
339339
"traits": {
340-
"smithy.api#required": true
340+
"smithy.api#required": {}
341341
}
342342
},
343343
"numberMember": {

docs/source/spec/core/protocol-traits.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ The following example defines a service that supports both the hypothetical
8383
"type": "service",
8484
"version": "2017-02-11",
8585
"traits": {
86-
"smithy.example#jsonExample": true,
87-
"smithy.example#xmlExample": true
86+
"smithy.example#jsonExample": {},
87+
"smithy.example#xmlExample": {}
8888
}
8989
},
9090
"smithy.example#jsonExample": {

docs/source/spec/core/resource-traits.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ to call ``CreateTable`` on a table that already exists will return an error.
6363
"target": "smithy.example#CreateTable"
6464
},
6565
"traits": {
66-
"smithy.api#noReplace": true
66+
"smithy.api#noReplace": {}
6767
}
6868
},
6969
"smithy.example#CreateTable": {
7070
"type": "operation",
7171
"traits": {
72-
"smithy.api#idempotent": true
72+
"smithy.api#idempotent": {}
7373
}
7474
}
7575
}

0 commit comments

Comments
 (0)