@@ -226,6 +226,16 @@ public ModelsMap postProcessModels(ModelsMap objs) {
226226 return objs ;
227227 }
228228
229+ private void setParameterDefaults (CodegenParameter param ) {
230+ // Set default values for optional parameters
231+ // Template will handle Option[] wrapping, so all defaults should be None
232+ if (!param .required ) {
233+ param .defaultValue = "None" ;
234+ }
235+ }
236+
237+
238+
229239 /**
230240 * Invoked by {@link DefaultGenerator} after all models have been post-processed,
231241 * allowing for a last pass of codegen-specific model cleanup.
@@ -445,6 +455,14 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
445455 }
446456 objs .setImports (newImports );
447457
458+ // Fix parameter types and defaults
459+ OperationMap opsMap = objs .getOperations ();
460+ for (CodegenOperation operation : opsMap .getOperation ()) {
461+ for (CodegenParameter param : operation .allParams ) {
462+ setParameterDefaults (param );
463+ }
464+ }
465+
448466 return super .postProcessOperationsWithModels (objs , allModels );
449467 }
450468
@@ -498,11 +516,11 @@ public String toDefaultValue(Schema p) {
498516 String inner = getSchemaType (ModelUtils .getAdditionalProperties (p ));
499517 return "Map[String, " + inner + "].empty " ;
500518 } else if (ModelUtils .isArraySchema (p )) {
501- String inner = getSchemaType ( ModelUtils . getSchemaItems ( p ));
519+ // Use simple Seq.empty for cleaner code
502520 if (ModelUtils .isSet (p )) {
503- return "Set[" + inner + "] .empty " ;
521+ return "Set.empty" ;
504522 }
505- return "Seq[" + inner + "] .empty " ;
523+ return "Seq.empty" ;
506524 } else if (ModelUtils .isStringSchema (p )) {
507525 return null ;
508526 } else {
0 commit comments