Skip to content

Commit c61fbf6

Browse files
Add sample stream to test package
This adds a bidirectional event stream to the test package so that new code generation for event streams can be examined.
1 parent a039242 commit c61fbf6

File tree

1 file changed

+71
-3
lines changed

1 file changed

+71
-3
lines changed

codegen/smithy-python-codegen-test/model/main.smithy

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ service Weather {
2020
operations: [
2121
GetCurrentTime
2222
TestUnionListOperation
23+
StreamAtmosphericConditions
2324
]
2425
}
2526

2627
resource City {
27-
identifiers: { cityId: CityId }
28+
identifiers: {
29+
cityId: CityId
30+
}
2831
read: GetCity
2932
list: ListCities
3033
resources: [
@@ -56,12 +59,16 @@ union UnionListMember {
5659
}
5760

5861
resource Forecast {
59-
identifiers: { cityId: CityId }
62+
identifiers: {
63+
cityId: CityId
64+
}
6065
read: GetForecast
6166
}
6267

6368
resource CityImage {
64-
identifiers: { cityId: CityId }
69+
identifiers: {
70+
cityId: CityId
71+
}
6572
read: GetCityImage
6673
}
6774

@@ -622,6 +629,67 @@ union Precipitation {
622629
baz: example.weather.nested.more#Baz
623630
}
624631

632+
@http(method: "POST", uri: "/cities/{cityId}/atmosphere")
633+
operation StreamAtmosphericConditions {
634+
input := {
635+
@required
636+
@httpLabel
637+
cityId: CityId
638+
639+
@required
640+
@httpPayload
641+
stream: AtmosphericConditions
642+
}
643+
644+
output := {
645+
@required
646+
@httpHeader("x-initial-sample-rate")
647+
initialSampleRate: Double
648+
649+
@required
650+
@httpPayload
651+
stream: CollectionDirectives
652+
}
653+
}
654+
655+
@streaming
656+
union AtmosphericConditions {
657+
humidity: HumiditySample
658+
pressure: PressureSample
659+
temperature: TemperatureSample
660+
}
661+
662+
@mixin
663+
structure Sample {
664+
@required
665+
collectionTime: Timestamp
666+
}
667+
668+
structure HumiditySample with [Sample] {
669+
@required
670+
humidity: Double
671+
}
672+
673+
structure PressureSample with [Sample] {
674+
@required
675+
pressure: Double
676+
}
677+
678+
structure TemperatureSample with [Sample] {
679+
@required
680+
temperature: Double
681+
}
682+
683+
@streaming
684+
union CollectionDirectives {
685+
sampleRate: SampleRate
686+
}
687+
688+
structure SampleRate {
689+
@required
690+
samplesPerMinute: Double
691+
}
692+
625693
structure OtherStructure {}
626694

627695
enum StringYesNo {

0 commit comments

Comments
 (0)