@@ -1442,7 +1442,7 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
1442
1442
addProperties (allProperties , allRequired , child , allDefinitions );
1443
1443
}
1444
1444
}
1445
- addVars (m , properties , required , allProperties , allRequired );
1445
+ addVars (m , properties , required , allDefinitions , allProperties , allRequired );
1446
1446
} else {
1447
1447
ModelImpl impl = (ModelImpl ) model ;
1448
1448
if (impl .getType () != null ) {
@@ -1458,7 +1458,7 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
1458
1458
if (impl .getAdditionalProperties () != null ) {
1459
1459
addAdditionPropertiesToCodeGenModel (m , impl );
1460
1460
}
1461
- addVars (m , impl .getProperties (), impl .getRequired ());
1461
+ addVars (m , impl .getProperties (), impl .getRequired (), allDefinitions );
1462
1462
}
1463
1463
1464
1464
if (m .vars != null ) {
@@ -3092,11 +3092,11 @@ protected void addImport(CodegenModel m, String type) {
3092
3092
}
3093
3093
}
3094
3094
3095
- private void addVars (CodegenModel m , Map <String , Property > properties , List <String > required ) {
3096
- addVars (m , properties , required , null , null );
3095
+ private void addVars (CodegenModel m , Map <String , Property > properties , List <String > required , Map < String , Model > allDefinitions ) {
3096
+ addVars (m , properties , required , allDefinitions , null , null );
3097
3097
}
3098
3098
3099
- private void addVars (CodegenModel m , Map <String , Property > properties , List <String > required ,
3099
+ private void addVars (CodegenModel m , Map <String , Property > properties , List <String > required , Map < String , Model > allDefinitions ,
3100
3100
Map <String , Property > allProperties , List <String > allRequired ) {
3101
3101
3102
3102
m .hasRequired = false ;
@@ -3107,7 +3107,7 @@ private void addVars(CodegenModel m, Map<String, Property> properties, List<Stri
3107
3107
3108
3108
Set <String > mandatory = required == null ? Collections .<String > emptySet ()
3109
3109
: new TreeSet <String >(required );
3110
- addVars (m , m .vars , properties , mandatory );
3110
+ addVars (m , m .vars , properties , mandatory , allDefinitions );
3111
3111
m .allMandatory = m .mandatory = mandatory ;
3112
3112
} else {
3113
3113
m .emptyVars = true ;
@@ -3118,12 +3118,12 @@ private void addVars(CodegenModel m, Map<String, Property> properties, List<Stri
3118
3118
if (allProperties != null ) {
3119
3119
Set <String > allMandatory = allRequired == null ? Collections .<String > emptySet ()
3120
3120
: new TreeSet <String >(allRequired );
3121
- addVars (m , m .allVars , allProperties , allMandatory );
3121
+ addVars (m , m .allVars , allProperties , allMandatory , allDefinitions );
3122
3122
m .allMandatory = allMandatory ;
3123
3123
}
3124
3124
}
3125
3125
3126
- private void addVars (CodegenModel m , List <CodegenProperty > vars , Map <String , Property > properties , Set <String > mandatory ) {
3126
+ private void addVars (CodegenModel m , List <CodegenProperty > vars , Map <String , Property > properties , Set <String > mandatory , Map < String , Model > allDefinitions ) {
3127
3127
// convert set to list so that we can access the next entry in the loop
3128
3128
List <Map .Entry <String , Property >> propertyList = new ArrayList <Map .Entry <String , Property >>(properties .entrySet ());
3129
3129
final int totalCount = propertyList .size ();
@@ -3146,6 +3146,17 @@ private void addVars(CodegenModel m, List<CodegenProperty> vars, Map<String, Pro
3146
3146
m .hasEnums = true ;
3147
3147
}
3148
3148
3149
+ if (allDefinitions != null && prop instanceof RefProperty ) {
3150
+ RefProperty refProperty = (RefProperty ) prop ;
3151
+ Model model = allDefinitions .get (refProperty .getSimpleRef ());
3152
+ if (model instanceof ModelImpl ) {
3153
+ ModelImpl modelImpl = (ModelImpl ) model ;
3154
+ cp .pattern = modelImpl .getPattern ();
3155
+ cp .minLength = modelImpl .getMinLength ();
3156
+ cp .maxLength = modelImpl .getMaxLength ();
3157
+ }
3158
+ }
3159
+
3149
3160
// set model's hasOnlyReadOnly to false if the property is read-only
3150
3161
if (!Boolean .TRUE .equals (cp .isReadOnly )) {
3151
3162
m .hasOnlyReadOnly = false ;
0 commit comments