* Add coverage for `intEnum` in all protocol tests
As part of IDL 2.0, the `intEnum` shape was added. The following changes
add several test cases using an `intEnum` shape (and/or aggregates)
under the `awsJson1_*`, *Query, and `RestXml` protocol test suites.
The integer type is a sort of vaugely supported thing in json schema,
not jsut OpenAPI. So this moves that configuration up to the generic
settings so it can also be applied to cloudformation and any future
derivative tooling.
The int32 / int64 formats were kept to openapi since that *isn't*
referenced in the the json schema spec.
* Fix cfn-mutability for inherited identifiers
For resources with parent resources, identifiers that are inherited
should be marked with create-and-read mutability instead of the
defaults for that resource. This fixes that case, and adjusts the
test cases to verify the correct behavior
This commit updates the validation for resource identifier collisions
to warn instead of error. When an explicit and implicit binding for
the same resource identifier are found, the explicit binding is
preferred.
Many of the validators in Smithy and Smithy Diff today emit events for
various reasons. A single validator might event different events with
different severities, and there is currently no way to suppress just
one specific type of event for a given validator. For example, the
ChangedNullability SmithyDiff validator emits events for various reasons,
some of which different tools may choose to suppress. However, without
inspecting the message of the event, there's no way to know what you're
suppressing.
To give existing validators the ability to emit more granular validation
events without breaking current validators, this change introduces
event ID hierarchies and hierarchical suppression IDs using dots (.).
For example, ChangedNullability.RemovedRequiredTrait is now emitted, and
tools can check for "ChangedNullability" to match all events, or more
granularly only match "ChangedNullability.RemovedRequiredTrait". This
can also be used in suppressions so that existing Smithy validators can
be updated to emit more granular events.
Some languages need to generate code before shapes are generated.
Previously such languages could have used the service generation hook
to perform this, but that was moved to occur after generating the
other shapes.
In smithy-diff, traits that have `diff` tags applied to their
definitions can be properly evaluated on modification. However,
it is possible for models to be loaded without trait definitions,
meaning no diff evaluation occurs. This commit updates the
ModifiedTrait evaluator to emit events when a trait without a
definition is not constant across the compared models.
Previously, the ABNF did not match the identifier parser.
This commit updates the ABNF to match current parsing behavior, and
updates the identifier parser to avoid out of bounds exceptions.
Also, a set of tests are added for ONLY parsing identifiers rather
than being mixed with namespace tests.
This commit introduces a new syntax for matching words with the
ReservedWords linter and is intended to be used with the upcoming
sensitive words linter defined in #1364.
In addition to supporting wildcard searches ("*" prefix, suffix,
and contains), we now support matching based on word boundaries.
This commit introduces the "terms" keyword for word boundary
searches and adds dedicated abstractions for word boundary and
wildcard matching.
For example, "access key id" will match "AccessKeyId",
"access_key_id", "accessKeyID", "access_key_id100", "AccesKeyIDValue".
It will also match when all the words are concatenated together:
"accesskeyid". However, it will not match "accesskey_id" because it
only has two word boundaries ("accesskey" and "id").
* Clarify that streaming trait members need httpPayload when using
an http binding protocol.
* Clarify that servers should interpret streaming members as
having a default value of zero bytes.
* Mention this in the v1 docs too.
* Fixed a doc linking issue for the streaming docs where we were
using the wrong casing.
Closes#1380
Addresses #1456
Smithy-Diff was flagging acceptable changes of removing `@default(null)` from
member when the trait had no effect because the target shape was already nullable.
NullableIndex was also giving the `@default(null)` trait precedence over the
`@required` trait which is incorrect. Required members are non-nullable, and
the `@default(null)` trait doesn't override this. It simply means that there is
no default value for the member (so coupled with the required trait, the member
is still always present).
This commit fixes an issue where documentation comments were dropped
for members that follow a member with a default value. Pending docs
are only cleared when a default isn't encountered or the container
is complete.
The suppress trait contained a restrictive pattern trait that was
not present in validator ID definitions. This meant that validation
events could be suppressed in metadata suppressions (where there was
no pattern validation), but not using the `@suppress` trait. Adding
the pattern from the `@suppress` trait to validation event IDs at
this point has the potential to break existing models, so that is
not a desirable alternative.
Closes#987
This validator now does not emit trait change warnings when the required
trait is changed, and instead relies on ChangedNullability (this matches
how the box trait is handled too). When the required trait is removed
from a member that targets a structure or union, a warning is emitted
instead of an error to indicate that this is often allowed in Smithy
generators that treat these members as always nullable regardless of
the required trait.
When loading a model with multiple members bound to the same resource identifier,
Smithy failed with an error in IdentifierBindingIndex due to Collectors.toMap:
Duplicate key X (attempted merging values y and z)
This change updates IdentifierBindingIndex to ignore collisions. However this
means that colliding resource identifier bindings would be ignored (which is
arguably worse than failing to load the model since it wouldn't ever flag
these issues, and retroactively enforcing things is always challenging).
To address this, I added validation to detect when members with the
resourceIdentifier trait conflict with members of the same binding name
or members that have the same resourceIdentifier trait.
We previously did not attempt to perform model interop transforms
if a model had errors. For example, if a model referred to an
unknown trait, the model wouldn't use the interop transformation.
Some use cases might choose to ignore unknown traits and other
errors by _not_ unwrapping the assembled model and instead
directly accessing the result from ValidatedResult. In these
cases, the model would have not gone through the interop transform,
resulting in an unexpect model (for example, if performing a diff
against a 1.0 and 2.0 model, the upgrade won't run and causes the
models to appear to be wildly different).