1- using System . Text ;
1+ using Riverside . CompilerPlatform . Helpers ;
2+ using System . Text ;
23
3- namespace Riverside . CompilerPlatform . Features . Swagger ;
4+ namespace Riverside . CompilerPlatform . Features . Kiota ;
45
56partial class KiotaEngine
67{
@@ -13,19 +14,19 @@ partial class KiotaEngine
1314 /// </returns>
1415 public override string ToString ( )
1516 {
16- var command = new StringBuilder ( ) . Append ( "kiota generate" ) ;
17+ var command = new StringBuilder ( ) . Append ( "generate" ) ;
1718
1819 if ( ! string . IsNullOrWhiteSpace ( Path ) )
1920 {
20- command . Append ( $ " --openapi { Path } ") ;
21+ command . Append ( $ " --openapi { SanitizationHelpers . EscapeArg ( Path ! ) } ") ;
2122 }
2223 if ( ! string . IsNullOrWhiteSpace ( Manifest ) )
2324 {
24- command . Append ( $ " --manifest { Manifest } ") ;
25+ command . Append ( $ " --manifest { SanitizationHelpers . EscapeArg ( Manifest ! ) } ") ;
2526 }
2627 if ( ! string . IsNullOrWhiteSpace ( Output ) )
2728 {
28- command . Append ( $ " --output { Output } ") ;
29+ command . Append ( $ " --output { SanitizationHelpers . EscapeArg ( Output ! ) } ") ;
2930 }
3031 command . Append ( $ " --language { Language } ") ;
3132 if ( ! string . IsNullOrWhiteSpace ( ClassName ) )
@@ -56,68 +57,68 @@ public override string ToString()
5657 {
5758 command . Append ( $ " --additional-data { AdditionalData } ") ;
5859 }
59- if ( Serializer is not null )
60+ if ( Serializer is not null && Serializer . Length > 0 )
6061 {
6162 var serializers = new StringBuilder ( ) . Append ( " --serializer " ) ;
6263 foreach ( var serializer in Serializer )
6364 {
6465 serializers . Append ( serializer + "|" ) ;
6566 }
66- serializers . Remove ( serializers . Length , 1 ) ; // remove final '|' char
67+ serializers . Remove ( serializers . Length - 1 , 1 ) ; // remove final '|' char
6768 command . Append ( serializers . ToString ( ) ) ;
6869 }
69- if ( Deserializer is not null )
70+ if ( Deserializer is not null && Deserializer . Length > 0 )
7071 {
7172 var deserializers = new StringBuilder ( ) . Append ( " --deserializer " ) ;
7273 foreach ( var deserializer in Deserializer )
7374 {
7475 deserializers . Append ( deserializer + "|" ) ;
7576 }
76- deserializers . Remove ( deserializers . Length , 1 ) ; // remove final '|' char
77+ deserializers . Remove ( deserializers . Length - 1 , 1 ) ; // remove final '|' char
7778 command . Append ( deserializers . ToString ( ) ) ;
7879 }
7980 if ( CleanOutput is not null )
8081 {
8182 command . Append ( $ " --clean-output { CleanOutput } ") ;
8283 }
83- if ( StructuredMimeTypes is not null )
84+ if ( StructuredMimeTypes is not null && StructuredMimeTypes . Length > 0 )
8485 {
8586 var structuredMimeTypes = new StringBuilder ( ) . Append ( " --structured-mime-types " ) ;
8687 foreach ( var structuredMimeType in StructuredMimeTypes )
8788 {
8889 structuredMimeTypes . Append ( structuredMimeType + "|" ) ;
8990 }
90- structuredMimeTypes . Remove ( structuredMimeTypes . Length , 1 ) ; // remove final '|' char
91+ structuredMimeTypes . Remove ( structuredMimeTypes . Length - 1 , 1 ) ; // remove final '|' char
9192 command . Append ( structuredMimeTypes . ToString ( ) ) ;
9293 }
93- if ( IncludePath is not null )
94+ if ( IncludePath is not null && IncludePath . Length > 0 )
9495 {
9596 var includePaths = new StringBuilder ( ) . Append ( " --include-path " ) ;
9697 foreach ( var includePath in IncludePath )
9798 {
9899 includePaths . Append ( includePath + "|" ) ;
99100 }
100- includePaths . Remove ( includePaths . Length , 1 ) ; // remove final '|' char
101+ includePaths . Remove ( includePaths . Length - 1 , 1 ) ; // remove final '|' char
101102 command . Append ( includePaths . ToString ( ) ) ;
102103 }
103- if ( ExcludePath is not null )
104+ if ( ExcludePath is not null && ExcludePath . Length > 0 )
104105 {
105106 var excludePaths = new StringBuilder ( ) . Append ( " --exclude-path " ) ;
106107 foreach ( var excludePath in ExcludePath )
107108 {
108109 excludePaths . Append ( excludePath + "|" ) ;
109110 }
110- excludePaths . Remove ( excludePaths . Length , 1 ) ; // remove final '|' char
111+ excludePaths . Remove ( excludePaths . Length - 1 , 1 ) ; // remove final '|' char
111112 command . Append ( excludePaths . ToString ( ) ) ;
112113 }
113- if ( DisableValidationRules is not null )
114+ if ( DisableValidationRules is not null && DisableValidationRules . Length > 0 )
114115 {
115116 var disableValidationRules = new StringBuilder ( ) . Append ( " --disable-validation-rules " ) ;
116117 foreach ( var disableValidationRule in DisableValidationRules )
117118 {
118119 disableValidationRules . Append ( disableValidationRule + "|" ) ;
119120 }
120- disableValidationRules . Remove ( disableValidationRules . Length , 1 ) ; // remove final '|' char
121+ disableValidationRules . Remove ( disableValidationRules . Length - 1 , 1 ) ; // remove final '|' char
121122 command . Append ( disableValidationRules . ToString ( ) ) ;
122123 }
123124 if ( ClearCache is not null )
0 commit comments