@@ -51,12 +51,15 @@ public bool ValidateCreatorConfig(CreatorConfig creatorConfig)
51
51
public bool ValidateProducts ( CreatorConfig creatorConfig )
52
52
{
53
53
bool isValid = true ;
54
- foreach ( ProductsTemplateProperties product in creatorConfig . products )
54
+ if ( creatorConfig . products != null )
55
55
{
56
- if ( product . displayName == null )
56
+ foreach ( ProductsTemplateProperties product in creatorConfig . products )
57
57
{
58
- isValid = false ;
59
- throw new CommandParsingException ( commandLineApplication , "Display name is required if an Product is provided" ) ;
58
+ if ( product . displayName == null )
59
+ {
60
+ isValid = false ;
61
+ throw new CommandParsingException ( commandLineApplication , "Display name is required if an Product is provided" ) ;
62
+ }
60
63
}
61
64
}
62
65
return isValid ;
@@ -65,12 +68,15 @@ public bool ValidateProducts(CreatorConfig creatorConfig)
65
68
public bool ValidateLoggers ( CreatorConfig creatorConfig )
66
69
{
67
70
bool isValid = true ;
68
- foreach ( LoggerConfig logger in creatorConfig . loggers )
71
+ if ( creatorConfig . loggers != null )
69
72
{
70
- if ( logger . name == null )
73
+ foreach ( LoggerConfig logger in creatorConfig . loggers )
71
74
{
72
- isValid = false ;
73
- throw new CommandParsingException ( commandLineApplication , "Name is required if an Logger is provided" ) ;
75
+ if ( logger . name == null )
76
+ {
77
+ isValid = false ;
78
+ throw new CommandParsingException ( commandLineApplication , "Name is required if an Logger is provided" ) ;
79
+ }
74
80
}
75
81
}
76
82
return isValid ;
@@ -79,12 +85,15 @@ public bool ValidateLoggers(CreatorConfig creatorConfig)
79
85
public bool ValidateBackends ( CreatorConfig creatorConfig )
80
86
{
81
87
bool isValid = true ;
82
- foreach ( BackendTemplateProperties backend in creatorConfig . backends )
88
+ if ( creatorConfig . backends != null )
83
89
{
84
- if ( backend . title == null )
90
+ foreach ( BackendTemplateProperties backend in creatorConfig . backends )
85
91
{
86
- isValid = false ;
87
- throw new CommandParsingException ( commandLineApplication , "Title is required if a Backend is provided" ) ;
92
+ if ( backend . title == null )
93
+ {
94
+ isValid = false ;
95
+ throw new CommandParsingException ( commandLineApplication , "Title is required if a Backend is provided" ) ;
96
+ }
88
97
}
89
98
}
90
99
return isValid ;
@@ -93,12 +102,15 @@ public bool ValidateBackends(CreatorConfig creatorConfig)
93
102
public bool ValidateAuthorizationServers ( CreatorConfig creatorConfig )
94
103
{
95
104
bool isValid = true ;
96
- foreach ( AuthorizationServerTemplateProperties authorizationServer in creatorConfig . authorizationServers )
105
+ if ( creatorConfig . authorizationServers != null )
97
106
{
98
- if ( authorizationServer . displayName == null )
107
+ foreach ( AuthorizationServerTemplateProperties authorizationServer in creatorConfig . authorizationServers )
99
108
{
100
- isValid = false ;
101
- throw new CommandParsingException ( commandLineApplication , "Display name is required if an Authorization Server is provided" ) ;
109
+ if ( authorizationServer . displayName == null )
110
+ {
111
+ isValid = false ;
112
+ throw new CommandParsingException ( commandLineApplication , "Display name is required if an Authorization Server is provided" ) ;
113
+ }
102
114
}
103
115
}
104
116
return isValid ;
@@ -178,12 +190,15 @@ public bool ValidateAPIs(CreatorConfig creatorConfig)
178
190
public bool ValidateAPIVersionSets ( CreatorConfig creatorConfig )
179
191
{
180
192
bool isValid = true ;
181
- foreach ( APIVersionSetConfig apiVersionSet in creatorConfig . apiVersionSets )
193
+ if ( creatorConfig . apiVersionSets != null )
182
194
{
183
- if ( apiVersionSet != null && apiVersionSet . displayName == null )
195
+ foreach ( APIVersionSetConfig apiVersionSet in creatorConfig . apiVersionSets )
184
196
{
185
- isValid = false ;
186
- throw new CommandParsingException ( commandLineApplication , "Display name is required if an API Version Set is provided" ) ;
197
+ if ( apiVersionSet != null && apiVersionSet . displayName == null )
198
+ {
199
+ isValid = false ;
200
+ throw new CommandParsingException ( commandLineApplication , "Display name is required if an API Version Set is provided" ) ;
201
+ }
187
202
}
188
203
}
189
204
return isValid ;
0 commit comments