generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 220
Add validation and codegen for custom validation exception traits #4317
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
Open
jasgin
wants to merge
53
commits into
smithy-lang:main
Choose a base branch
from
jasgin:custom-validation-exception
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,002
−8
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0812440
to
5789de4
Compare
drganjoo
reviewed
Sep 30, 2025
codegen-server-test/custom-test-models/custom-validation-exception.smithy
Show resolved
Hide resolved
...re/amazon/smithy/rust/codegen/server/smithy/validators/CustomValidationExceptionValidator.kt
Outdated
Show resolved
Hide resolved
...smithy/rust/codegen/server/smithy/customizations/UserProvidedValidationExceptionDecorator.kt
Show resolved
Hide resolved
...mazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt
Outdated
Show resolved
Hide resolved
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/Constraints.kt
Outdated
Show resolved
Hide resolved
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/Constraints.kt
Outdated
Show resolved
Hide resolved
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/Constraints.kt
Outdated
Show resolved
Hide resolved
...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt
Outdated
Show resolved
Hide resolved
rcoh
reviewed
Sep 30, 2025
...mazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
...mazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
.../kotlin/software/amazon/smithy/rust/codegen/server/smithy/traits/ValidationFieldNameTrait.kt
Show resolved
Hide resolved
...mazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
...mazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
...mazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
...mazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
...mazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
0d79bd7
to
3f8e8b5
Compare
2 tasks
rcoh
pushed a commit
that referenced
this pull request
Oct 3, 2025
#4321) ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> Extension of #4317. This PR will add the traits and the #4317 will be used to add the validation and codegen. Deferring moving existing traits to this new package to another PR to avoid clashing refactors with features. ## Description <!--- Describe your changes in detail --> ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] For changes to the smithy-rs codegen or runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "client," "server," or both in the `applies_to` key. - [x] For changes to the AWS SDK, generated SDK code, or SDK runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "aws-sdk-rust" in the `applies_to` key. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
3f8e8b5
to
234f108
Compare
rcoh
reviewed
Oct 6, 2025
.../kotlin/software/amazon/smithy/rust/codegen/server/smithy/traits/ValidationExceptionTrait.kt
Outdated
Show resolved
Hide resolved
301ac0c
to
ff62652
Compare
ff62652
to
bf14a00
Compare
rcoh
reviewed
Oct 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can decide if we want another pass on the codegen stuff. otherwise looks fine
...smithy/rust/codegen/server/smithy/customizations/UserProvidedValidationExceptionDecorator.kt
Show resolved
Hide resolved
...mazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
...smithy/rust/codegen/server/smithy/customizations/UserProvidedValidationExceptionDecorator.kt
Show resolved
Hide resolved
...smithy/rust/codegen/server/smithy/customizations/UserProvidedValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
...smithy/rust/codegen/server/smithy/customizations/UserProvidedValidationExceptionDecorator.kt
Show resolved
Hide resolved
...mazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
...smithy/rust/codegen/server/smithy/customizations/UserProvidedValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
...smithy/rust/codegen/server/smithy/customizations/UserProvidedValidationExceptionDecorator.kt
Show resolved
Hide resolved
rcoh
reviewed
Oct 8, 2025
...erver/src/main/resources/META-INF/services/software.amazon.smithy.model.validation.Validator
Outdated
Show resolved
Hide resolved
rcoh
reviewed
Oct 8, 2025
...smithy/rust/codegen/server/smithy/customizations/UserProvidedValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
rcoh
reviewed
Oct 8, 2025
...n/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecoratorTest.kt
Show resolved
Hide resolved
rcoh
reviewed
Oct 8, 2025
...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt
Outdated
Show resolved
Hide resolved
rcoh
reviewed
Oct 8, 2025
...n/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecoratorTest.kt
Show resolved
Hide resolved
84c49f5
to
d9c39b1
Compare
d9c39b1
to
9b5299c
Compare
…ver SmithyValidationExceptionDecorator
# Conflicts: # codegen-server-test/integration-tests/Cargo.lock
bcd5045
to
e58ce74
Compare
e58ce74
to
de18e9b
Compare
rcoh
approved these changes
Oct 14, 2025
...smithy/rust/codegen/server/smithy/customizations/UserProvidedValidationExceptionDecorator.kt
Outdated
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Adds ability to define custom validation exceptions per RFC:
Description
Adds ability to use the following traits:
to define a custom validation exception for a service or operation.
Updated Smithy validation ensures:
smithy.framework#ValidationException
is not used in an operation or service is a custom validation exception is definedTesting
codegen-server-traits/src/test/kotlin/software/amazon/smithy/rust/codegen/server/traits/ValidationExceptionTraitTest.kt
codegen-server-traits/src/test/kotlin/software/amazon/smithy/rust/codegen/server/traits/ValidationMessageTraitTest.kt
codegen-server-traits/src/test/kotlin/software/amazon/smithy/rust/codegen/server/traits/ValidationFieldListTraitTest.kt
codegen-server-traits/src/test/kotlin/software/amazon/smithy/rust/codegen/server/traits/ValidationFieldNameTraitTest.kt
codegen-server-traits/src/test/kotlin/software/amazon/smithy/rust/codegen/server/traits/ValidationFieldMessageTraitTest.kt
codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraintsAreNotUsedTest.kt
codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecoratorTest.kt
codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/validators/CustomValidationExceptionValidatorTest.kt
codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/CustomValidationExceptionDecoratorTest.kt
codegen-server-test/custom-test-models/custom-validation-exception.smithy
codegen-server-test/build.gradle.kts
codegen-server-tests
use common models incodegen-core/common-test-models
, which use the defaultsmithy.framework#ValidationException
Ran with
export RUSTFLAGS="-D warnings -A clippy::redundant_closure -A non_local_definitions"
until fixed in server runtime crates. See #4122.Checklist
.changelog
directory, specifying "client," "server," or both in theapplies_to
key..changelog
directory, specifying "aws-sdk-rust" in theapplies_to
key.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.