@@ -45,6 +45,11 @@ public ComLineProcesser(string[] args)
45
45
/// </summary>
46
46
public OpenApiFormat ? Format { get ; private set ; }
47
47
48
+ /// <summary>
49
+ /// Whether KeyAsSegment is used.
50
+ /// </summary>
51
+ public bool ? KeyAsSegment { get ; private set ; }
52
+
48
53
/// <summary>
49
54
/// Output OpenApi Specification Version.
50
55
/// </summary>
@@ -60,6 +65,31 @@ public ComLineProcesser(string[] args)
60
65
/// </summary>
61
66
public bool IsLocalFile { get ; private set ; }
62
67
68
+ /// <summary>
69
+ /// Set the output to produce all derived types in responses.
70
+ /// </summary>
71
+ public bool ? DerivedTypesReferencesForResponses { get ; private set ; }
72
+
73
+ /// <summary>
74
+ /// Set the output to expect all derived types in request bodies.
75
+ /// </summary>
76
+ public bool ? DerivedTypesReferencesForRequestBody { get ; private set ; }
77
+
78
+ /// <summary>
79
+ /// Set the output to expose pagination for collections.
80
+ /// </summary>
81
+ public bool ? EnablePagination { get ; private set ; }
82
+
83
+ /// <summary>
84
+ /// tSet the output to use unqualified calls for bound operations.
85
+ /// </summary>
86
+ public bool ? EnableUnqualifiedCall { get ; private set ; }
87
+
88
+ /// <summary>
89
+ /// tDisable examples in the schema.
90
+ /// </summary>
91
+ public bool ? DisableSchemaExamples { get ; private set ; }
92
+
63
93
/// <summary>
64
94
/// Process the arguments.
65
95
/// </summary>
@@ -98,6 +128,14 @@ public bool Process()
98
128
i ++ ;
99
129
break ;
100
130
131
+ case "--keyassegment" :
132
+ case "-k" :
133
+ if ( ! ProcessKeyAsSegment ( true ) )
134
+ {
135
+ return false ;
136
+ }
137
+ break ;
138
+
101
139
case "--yaml" :
102
140
case "-y" :
103
141
if ( ! ProcessTarget ( OpenApiFormat . Yaml ) )
@@ -132,6 +170,46 @@ public bool Process()
132
170
i ++ ;
133
171
break ;
134
172
173
+ case "--derivedtypesreferencesforresponses" :
174
+ case "-drs" :
175
+ if ( ! ProcessDerivedTypesReferencesForResponses ( true ) )
176
+ {
177
+ return false ;
178
+ }
179
+ break ;
180
+
181
+ case "--derivedtypesreferencesforrequestbody" :
182
+ case "-drq" :
183
+ if ( ! ProcessDerivedTypesReferencesForRequestBody ( true ) )
184
+ {
185
+ return false ;
186
+ }
187
+ break ;
188
+
189
+ case "--enablepagination" :
190
+ case "-p" :
191
+ if ( ! ProcessEnablePagination ( true ) )
192
+ {
193
+ return false ;
194
+ }
195
+ break ;
196
+
197
+ case "--enableunqualifiedcall" :
198
+ case "-u" :
199
+ if ( ! ProcessEnableUnqualifiedCall ( true ) )
200
+ {
201
+ return false ;
202
+ }
203
+ break ;
204
+
205
+ case "--disableschemaexamples" :
206
+ case "-x" :
207
+ if ( ! ProcessDisableSchemaExamples ( true ) )
208
+ {
209
+ return false ;
210
+ }
211
+ break ;
212
+
135
213
default :
136
214
PrintUsage ( ) ;
137
215
return false ;
@@ -155,6 +233,36 @@ public bool Process()
155
233
Version = OpenApiSpecVersion . OpenApi3_0 ;
156
234
}
157
235
236
+ if ( KeyAsSegment == null )
237
+ {
238
+ KeyAsSegment = false ;
239
+ }
240
+
241
+ if ( DerivedTypesReferencesForResponses == null )
242
+ {
243
+ DerivedTypesReferencesForResponses = false ;
244
+ }
245
+
246
+ if ( DerivedTypesReferencesForRequestBody == null )
247
+ {
248
+ DerivedTypesReferencesForRequestBody = false ;
249
+ }
250
+
251
+ if ( EnablePagination == null )
252
+ {
253
+ EnablePagination = false ;
254
+ }
255
+
256
+ if ( EnableUnqualifiedCall == null )
257
+ {
258
+ EnableUnqualifiedCall = false ;
259
+ }
260
+
261
+ if ( DisableSchemaExamples == null )
262
+ {
263
+ DisableSchemaExamples = false ;
264
+ }
265
+
158
266
_continue = ValidateArguments ( ) ;
159
267
return _continue ;
160
268
}
@@ -198,6 +306,84 @@ private bool ProcessTarget(OpenApiFormat format)
198
306
return true ;
199
307
}
200
308
309
+ private bool ProcessKeyAsSegment ( bool keyAsSegment )
310
+ {
311
+ if ( KeyAsSegment != null )
312
+ {
313
+ Console . WriteLine ( "[Error:] Multiple [--keyassegment|-k] are not allowed.\n " ) ;
314
+ PrintUsage ( ) ;
315
+ return false ;
316
+ }
317
+
318
+ KeyAsSegment = keyAsSegment ;
319
+ return true ;
320
+ }
321
+
322
+ private bool ProcessDerivedTypesReferencesForResponses ( bool derivedTypesReferencesForResponses )
323
+ {
324
+ if ( DerivedTypesReferencesForResponses != null )
325
+ {
326
+ Console . WriteLine ( "[Error:] Multiple [--derivedtypesreferencesforresponses|-drs] are not allowed.\n " ) ;
327
+ PrintUsage ( ) ;
328
+ return false ;
329
+ }
330
+
331
+ DerivedTypesReferencesForResponses = derivedTypesReferencesForResponses ;
332
+ return true ;
333
+ }
334
+
335
+ private bool ProcessDerivedTypesReferencesForRequestBody ( bool derivedTypesReferencesForRequestBody )
336
+ {
337
+ if ( DerivedTypesReferencesForRequestBody != null )
338
+ {
339
+ Console . WriteLine ( "[Error:] Multiple [--derivedtypesreferencesforrequestbody|-drq] are not allowed.\n " ) ;
340
+ PrintUsage ( ) ;
341
+ return false ;
342
+ }
343
+
344
+ DerivedTypesReferencesForRequestBody = derivedTypesReferencesForRequestBody ;
345
+ return true ;
346
+ }
347
+
348
+ private bool ProcessEnablePagination ( bool enablePagination )
349
+ {
350
+ if ( EnablePagination != null )
351
+ {
352
+ Console . WriteLine ( "[Error:] Multiple [--enablepagination|-p] are not allowed.\n " ) ;
353
+ PrintUsage ( ) ;
354
+ return false ;
355
+ }
356
+
357
+ EnablePagination = enablePagination ;
358
+ return true ;
359
+ }
360
+
361
+ private bool ProcessEnableUnqualifiedCall ( bool enableUnqualifiedCall )
362
+ {
363
+ if ( EnableUnqualifiedCall != null )
364
+ {
365
+ Console . WriteLine ( "[Error:] Multiple [--enableunqualifiedcall|-u] are not allowed.\n " ) ;
366
+ PrintUsage ( ) ;
367
+ return false ;
368
+ }
369
+
370
+ EnableUnqualifiedCall = enableUnqualifiedCall ;
371
+ return true ;
372
+ }
373
+
374
+ private bool ProcessDisableSchemaExamples ( bool disableSchemaExamples )
375
+ {
376
+ if ( DisableSchemaExamples != null )
377
+ {
378
+ Console . WriteLine ( "[Error:] Multiple [--disableschemaexamples|-x] are not allowed.\n " ) ;
379
+ PrintUsage ( ) ;
380
+ return false ;
381
+ }
382
+
383
+ DisableSchemaExamples = disableSchemaExamples ;
384
+ return true ;
385
+ }
386
+
201
387
private bool ProcessTarget ( int version )
202
388
{
203
389
if ( Version != null )
@@ -256,6 +442,12 @@ public static void PrintUsage()
256
442
sb . Append ( " --version|-v\t \t \t Display version.\n " ) ;
257
443
sb . Append ( " --input|-i CsdlFileOrUrl\t Set the CSDL file name or the OData Service Url.\n " ) ;
258
444
sb . Append ( " --output|-o OutputFile\t Set the output file name.\n " ) ;
445
+ sb . Append ( " --keyassegment|-k\t \t \t Set the output to use key-as-segment style URLs.\n " ) ;
446
+ sb . Append ( " --derivedtypesreferencesforresponses|-drs\t \t \t Set the output to produce all derived types in responses.\n " ) ;
447
+ sb . Append ( " --derivedtypesreferencesforrequestbody|-drq\t \t \t Set the output to expect all derived types in request bodies.\n " ) ;
448
+ sb . Append ( " --enablepagination|-p\t \t \t Set the output to expose pagination for collections.\n " ) ;
449
+ sb . Append ( " --enableunqualifiedcall|-u\t \t \t Set the output to use unqualified calls for bound operations.\n " ) ;
450
+ sb . Append ( " --disableschemaexamples|-x\t \t \t Disable examples in the schema.\n " ) ;
259
451
sb . Append ( " --json|-j\t \t \t Set the output format as JSON.\n " ) ;
260
452
sb . Append ( " --yaml|-y\t \t \t Set the output format as YAML.\n " ) ;
261
453
sb . Append ( " --specversion|-s IntVersion\t Set the OpenApi Specification version of the output. Only 2 or 3 are supported.\n " ) ;
0 commit comments