Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Smithy Rust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Public Repositories
Smithy Rust
Commits
42f9ad98
Unverified
Commit
42f9ad98
authored
2 years ago
by
david-perez
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Simplify calculation of error shapes in `EventStreamTestTools.kt` (#2130)
parent
6211a914
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/EventStreamTestTools.kt
+3
-7
3 additions, 7 deletions
...smithy/rust/codegen/core/testutil/EventStreamTestTools.kt
with
3 additions
and
7 deletions
codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/EventStreamTestTools.kt
+
3
−
7
View file @
42f9ad98
...
@@ -34,7 +34,6 @@ import software.amazon.smithy.rust.codegen.core.testutil.EventStreamUnmarshallTe
...
@@ -34,7 +34,6 @@ import software.amazon.smithy.rust.codegen.core.testutil.EventStreamUnmarshallTe
import
software.amazon.smithy.rust.codegen.core.util.hasTrait
import
software.amazon.smithy.rust.codegen.core.util.hasTrait
import
software.amazon.smithy.rust.codegen.core.util.lookup
import
software.amazon.smithy.rust.codegen.core.util.lookup
import
software.amazon.smithy.rust.codegen.core.util.outputShape
import
software.amazon.smithy.rust.codegen.core.util.outputShape
import
kotlin.streams.toList
data class
TestEventStreamProject
(
data class
TestEventStreamProject
(
val
model
:
Model
,
val
model
:
Model
,
...
@@ -115,16 +114,13 @@ object EventStreamTestTools {
...
@@ -115,16 +114,13 @@ object EventStreamTestTools {
val
project
=
TestWorkspace
.
testProject
(
symbolProvider
)
val
project
=
TestWorkspace
.
testProject
(
symbolProvider
)
val
operationSymbol
=
symbolProvider
.
toSymbol
(
operationShape
)
val
operationSymbol
=
symbolProvider
.
toSymbol
(
operationShape
)
project
.
withModule
(
ErrorsModule
)
{
project
.
withModule
(
ErrorsModule
)
{
val
errors
=
model
.
shapes
()
val
errors
=
model
.
structureShapes
.
filter
{
shape
->
shape
.
hasTrait
<
ErrorTrait
>()
}
.
filter
{
shape
->
shape
.
isStructureShape
&&
shape
.
hasTrait
<
ErrorTrait
>()
}
.
map
{
it
.
asStructureShape
().
get
()
}
.
toList
()
when
(
codegenTarget
)
{
when
(
codegenTarget
)
{
CodegenTarget
.
CLIENT
->
CombinedErrorGenerator
(
model
,
symbolProvider
,
operationSymbol
,
errors
).
render
(
this
)
CodegenTarget
.
CLIENT
->
CombinedErrorGenerator
(
model
,
symbolProvider
,
operationSymbol
,
errors
).
render
(
this
)
CodegenTarget
.
SERVER
->
ServerCombinedErrorGenerator
(
model
,
symbolProvider
,
operationSymbol
,
errors
).
render
(
this
)
CodegenTarget
.
SERVER
->
ServerCombinedErrorGenerator
(
model
,
symbolProvider
,
operationSymbol
,
errors
).
render
(
this
)
}
}
for
(
shape
in
model
.
shapes
()
.
filter
{
shape
->
shape
is
StructureShape
&&
shape
.
hasTrait
<
ErrorTrait
>()
})
{
for
(
shape
in
model
.
s
tructureS
hapes
.
filter
{
shape
->
shape
.
hasTrait
<
ErrorTrait
>()
})
{
StructureGenerator
(
model
,
symbolProvider
,
this
,
shape
as
StructureShape
).
render
(
codegenTarget
)
StructureGenerator
(
model
,
symbolProvider
,
this
,
shape
).
render
(
codegenTarget
)
requirements
.
renderBuilderForShape
(
this
,
codegenContext
,
shape
)
requirements
.
renderBuilderForShape
(
this
,
codegenContext
,
shape
)
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment