-
Notifications
You must be signed in to change notification settings - Fork 196
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
Compile regexes for @pattern
strings early
#2058
Conversation
f48be55
to
0edb00f
Compare
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.
This is good but we should also code-generate a #[test]
per pattern compiling each regex to do even earlier detection.
A Kotlin unit test exercising a model whose pattern
is accepted by Smithy but not by the regex
crate that asserts that the tests fail and that the service panics at startup would be nice too.
...lin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGeneratorV2.kt
Outdated
Show resolved
Hide resolved
...lin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGeneratorV2.kt
Outdated
Show resolved
Hide resolved
...n/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedStringGenerator.kt
Outdated
Show resolved
Hide resolved
…egen/server/smithy/generators/ConstrainedStringGenerator.kt Co-authored-by: Luca Palmieri <[email protected]>
A new generated diff is ready to view.
A new doc preview is ready to view. |
@david-perez Added a Kotlin test in 2873529. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
assertThrows<CommandFailed> { | ||
project.compileAndTest() | ||
} |
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.
Can we in any way verify the message it fails with, to make sure it fails for the reason we expect?
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.
yeah—you can look at the error message. An example:
val failure = shouldThrow<CommandFailed> { "cargo test".runWithWarnings(testDir) }
failure.output shouldContain "endpoint::test::test_1"
failure.output shouldContain "https://failingtest.com"
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.
Lovely, thanks!
...lin/software/amazon/smithy/rust/codegen/server/smithy/generators/ServerServiceGeneratorV2.kt
Outdated
Show resolved
Hide resolved
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.
lgtm!
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
Description
Completes #2026.
${service}Builder::build()
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.