File tree Expand file tree Collapse file tree 4 files changed +8
-25
lines changed
src/GraphODataTemplateWriter Expand file tree Collapse file tree 4 files changed +8
-25
lines changed Original file line number Diff line number Diff line change 1818
1919
2020<# foreach(var enumType in enumTypes) { #>
21- export type <#= writer.UpperCaseFirstChar( enumType.Name) #> = <#= enumType.GetEnumValues() #>
21+ export type <#= enumType.Name.UpperCaseFirstChar( ) #> = <#= enumType.GetEnumValues() #>
2222<# } #>
2323<#
2424 foreach(var entityType in entityTypes)
2525 {
2626 var methods = entityType.Methods;
2727#>
2828
29- export interface <#= writer.UpperCaseFirstChar( entityType.Name) #><# if (entityType.Base != null) { #> extends <#= writer.UpperCaseFirstChar( entityType.Base.Name) #><# }#> {
29+ export interface <#= entityType.Name.UpperCaseFirstChar( ) #><# if (entityType.Base != null) { #> extends <#= entityType.Base.Name.UpperCaseFirstChar( ) #><# }#> {
3030<# foreach(var prop in entityType.Properties.ToList()) { #>
3131 <#= prop.Name #>?: <#= prop.GetTypeString() #>
3232<# } #>
@@ -39,7 +39,7 @@ export interface <#= writer.UpperCaseFirstChar(entityType.Name) #><# if (entityT
3939 {
4040#>
4141
42- export interface <#= writer.UpperCaseFirstChar( complexType.Name)#> {
42+ export interface <#= complexType.Name.UpperCaseFirstChar( )#> {
4343<# foreach(var prop in complexType.Properties) { #>
4444 <#= prop.Name #>?: <#= prop.GetTypeString() #>
4545<# } #>
Original file line number Diff line number Diff line change @@ -30,10 +30,6 @@ public override String NewLineCharacter
3030 {
3131 get { return "\n " ; }
3232 }
33- public String UpperCaseFirstChar ( String s )
34- {
35- return char . ToUpper ( s [ 0 ] ) + s . Substring ( 1 ) ;
36- }
3733
3834 }
3935
Original file line number Diff line number Diff line change @@ -4,33 +4,20 @@ namespace Microsoft.Graph.ODataTemplateWriter.CodeHelpers.TypeScript
44{
55 using Vipr . Core . CodeModel ;
66 using System ;
7- using System . Collections . Generic ;
87 using System . Linq ;
98
109 public static class TypeHelperTypeScript
1110 {
1211
1312 // enum value string, ex: "low" | "normal" | "high"
1413 public static String GetEnumValues ( this OdcmEnum _enum ) {
15- String enumVals = null ;
16- foreach ( var member in _enum . Members )
17- {
18- if ( enumVals == null )
19- {
20- enumVals = '"' + member . Name + '"' ;
21- } else
22- {
23- enumVals += " | " + '"' + member . Name + '"' ;
24- }
25- }
26-
27- return enumVals ;
14+ return _enum . Members . Select ( m => "\" " + m . Name + "\" " ) . Aggregate ( ( cur , next ) => cur + " | " + next ) ;
2815 }
2916
3017
3118 public static string GetTypeString ( this OdcmProperty prop )
3219 {
33- string typeStr = UpperCaseFirstChar ( prop . Type . Name ) ;
20+ string typeStr = prop . Type . Name . UpperCaseFirstChar ( ) ;
3421
3522 switch ( typeStr )
3623 {
@@ -62,7 +49,7 @@ public static string GetTypeString(this OdcmProperty prop)
6249 return ( prop . IsCollection ) ? "[" + typeStr + "]" : typeStr ;
6350
6451 }
65- public static String UpperCaseFirstChar ( String s )
52+ public static String UpperCaseFirstChar ( this String s )
6653 {
6754 return char . ToUpper ( s [ 0 ] ) + s . Substring ( 1 ) ;
6855 }
Original file line number Diff line number Diff line change @@ -45,9 +45,9 @@ private string CreateNamespace(string folderName)
4545
4646 private string CreatePathFromNamespace ( string @namespace )
4747 {
48- var splittedPaths = @namespace . Split ( '.' ) ;
48+ var splitPaths = @namespace . Split ( '.' ) ;
4949
50- var destinationPath = splittedPaths . Aggregate ( string . Empty , ( current , path ) =>
50+ var destinationPath = splitPaths . Aggregate ( string . Empty , ( current , path ) =>
5151 current + string . Format ( "{0}{1}" , path , Path . DirectorySeparatorChar ) ) ;
5252 return destinationPath ;
5353 }
You can’t perform that action at this time.
0 commit comments