smithy-lang / smithy-dafny

Apache License 2.0
9 stars 8 forks source link

Implement linting/smithy-diff/validation rules for traits like @positional and @reference #315

Open robin-aws opened 8 months ago

robin-aws commented 8 months ago

@positional intentionally changes the rules around backwards compatibility in the name of a cleaner and simpler generated code API experience. The documentation of the trait is fairly clear about this, but Smithy tooling like smithy-diff is not aware of it. Especially if this trait is used in other contexts beyond this, it would be worth emitting a warning at model validation time.

There are similar gaps for @reference as well: Smithy itself will let you use an empty structure tagged with @reference directly as the output of an operation, which is a natural mistake.

robin-aws commented 5 months ago

Validators for traits are pluggable as well. Here's where a bunch of the validators for core traits are declared: https://github.com/smithy-lang/smithy/blob/main/smithy-model/src/main/resources/META-INF/services/software.amazon.smithy.model.validation.Validator