45
45
import software .amazon .smithy .model .shapes .ServiceShape ;
46
46
import software .amazon .smithy .model .shapes .ShapeId ;
47
47
import software .amazon .smithy .model .traits .PaginatedTrait ;
48
+ import software .amazon .smithy .model .validation .ValidationEvent ;
48
49
import software .amazon .smithy .typescript .codegen .integration .ProtocolGenerator ;
49
50
import software .amazon .smithy .typescript .codegen .integration .RuntimeClientPlugin ;
50
51
import software .amazon .smithy .typescript .codegen .integration .TypeScriptIntegration ;
52
+ import software .amazon .smithy .typescript .codegen .validation .LongValidator ;
51
53
import software .amazon .smithy .utils .MapUtils ;
52
54
import software .amazon .smithy .utils .SmithyUnstableApi ;
53
55
import software .amazon .smithy .waiters .WaitableTrait ;
@@ -140,8 +142,19 @@ private ProtocolGenerator resolveProtocolGenerator(
140
142
@ Override
141
143
public void generateService (GenerateServiceDirective <TypeScriptCodegenContext , TypeScriptSettings > directive ) {
142
144
TypeScriptSettings settings = directive .settings ();
145
+ Model model = directive .model ();
146
+ ServiceShape service = directive .shape ();
143
147
TypeScriptDelegator delegator = directive .context ().writerDelegator ();
144
148
149
+ if (settings .generateServerSdk ()) {
150
+ checkValidationSettings (settings , model , service );
151
+
152
+ LongValidator validator = new LongValidator (settings );
153
+ List <ValidationEvent > events = validator .validate (model );
154
+ System .err .println ("Model contained SSDK-specific validation events: \n "
155
+ + events .stream ().map (ValidationEvent ::toString ).sorted ().collect (Collectors .joining ("\n " )));
156
+ }
157
+
145
158
if (settings .generateClient ()) {
146
159
generateClient (directive );
147
160
}
@@ -154,8 +167,6 @@ public void generateService(GenerateServiceDirective<TypeScriptCodegenContext, T
154
167
}
155
168
156
169
ProtocolGenerator protocolGenerator = directive .context ().protocolGenerator ();
157
- ServiceShape service = directive .shape ();
158
- Model model = directive .model ();
159
170
SymbolProvider symbolProvider = directive .symbolProvider ();
160
171
List <TypeScriptIntegration > integrations = directive .context ().integrations ();
161
172
if (protocolGenerator != null ) {
@@ -407,7 +418,6 @@ public void customizeBeforeIntegrations(
407
418
directive .context ().protocolGenerator ());
408
419
409
420
if (directive .settings ().generateServerSdk ()) {
410
- checkValidationSettings (directive .settings (), directive .model (), directive .service ());
411
421
// Generate index for server
412
422
IndexGenerator .writeServerIndex (
413
423
directive .settings (),
0 commit comments