@@ -11,10 +11,10 @@ public class ClassNameHelper : INustacheHelper
1111 {
1212 private readonly Dictionary < string , string > classNameMap ;
1313 private readonly HashSet < string > schemaDefinitionsInMultipleGroups ;
14- private readonly Dictionary < JsonSchema4 , string > schemaToNameMapCooked ;
15- private readonly Dictionary < JsonSchema4 , string > schemaToNameMapUnprocessed ;
14+ private readonly Dictionary < JsonSchema , string > schemaToNameMapCooked ;
15+ private readonly Dictionary < JsonSchema , string > schemaToNameMapUnprocessed ;
1616
17- public ClassNameHelper ( SwaggerDocument swaggerCooked , SwaggerDocument swaggerUnprocessed )
17+ public ClassNameHelper ( OpenApiDocument swaggerCooked , OpenApiDocument swaggerUnprocessed )
1818 {
1919 classNameMap = InitClassNameMap ( swaggerCooked ) ;
2020
@@ -28,19 +28,19 @@ public void RegisterHelper()
2828 Helpers . Register ( nameof ( GetClassName ) , GetClassName ) ;
2929 }
3030
31- private static Dictionary < JsonSchema4 , string > GenerateSchemaToNameMapUnprocessed (
32- SwaggerDocument swaggerUnprocessed )
31+ private static Dictionary < JsonSchema , string > GenerateSchemaToNameMapUnprocessed (
32+ OpenApiDocument swaggerUnprocessed )
3333 {
3434 return swaggerUnprocessed . Definitions . ToDictionary ( x => x . Value , x => x . Key ) ;
3535 }
3636
37- private static Dictionary < JsonSchema4 , string > GenerateSchemaToNameMapCooked ( SwaggerDocument swaggerCooked )
37+ private static Dictionary < JsonSchema , string > GenerateSchemaToNameMapCooked ( OpenApiDocument swaggerCooked )
3838 {
3939 return swaggerCooked . Definitions . ToDictionary ( x => x . Value , x => x . Key . Replace ( "." , "" ) . ToPascalCase ( ) ) ;
4040 }
4141
4242 private static HashSet < string > InitSchemaDefinitionsInMultipleGroups (
43- Dictionary < JsonSchema4 , string > schemaToNameMap )
43+ Dictionary < JsonSchema , string > schemaToNameMap )
4444 {
4545 return schemaToNameMap . Values . Select ( x =>
4646 {
@@ -60,7 +60,7 @@ private static HashSet<string> InitSchemaDefinitionsInMultipleGroups(
6060 . ToHashSet ( ) ;
6161 }
6262
63- private Dictionary < string , string > InitClassNameMap ( SwaggerDocument doc )
63+ private Dictionary < string , string > InitClassNameMap ( OpenApiDocument doc )
6464 {
6565 var map = new Dictionary < string , string > ( ) ;
6666 foreach ( var ( k , v ) in doc . Definitions )
@@ -83,17 +83,17 @@ private Dictionary<string, string> InitClassNameMap(SwaggerDocument doc)
8383 public void GetClassName ( RenderContext context , IList < object > arguments , IDictionary < string , object > options ,
8484 RenderBlock fn , RenderBlock inverse )
8585 {
86- if ( arguments != null && arguments . Count > 0 && arguments [ 0 ] != null && arguments [ 0 ] is SwaggerOperation )
86+ if ( arguments != null && arguments . Count > 0 && arguments [ 0 ] != null && arguments [ 0 ] is OpenApiOperation )
8787 {
88- context . Write ( GetClassName ( arguments [ 0 ] as SwaggerOperation ) ) ;
88+ context . Write ( GetClassName ( arguments [ 0 ] as OpenApiOperation ) ) ;
8989 }
90- else if ( arguments != null && arguments . Count > 0 && arguments [ 0 ] != null && arguments [ 0 ] is JsonSchema4 )
90+ else if ( arguments != null && arguments . Count > 0 && arguments [ 0 ] != null && arguments [ 0 ] is JsonSchema )
9191 {
92- context . Write ( GetClassNameForSchemaDefinition ( arguments [ 0 ] as JsonSchema4 ) ) ;
92+ context . Write ( GetClassNameForSchemaDefinition ( arguments [ 0 ] as JsonSchema ) ) ;
9393 }
9494 }
9595
96- public string GetClassName ( SwaggerOperation operation )
96+ public string GetClassName ( OpenApiOperation operation )
9797 {
9898 var groupVersionKind =
9999 ( Dictionary < string , object > ) operation . ExtensionData [ "x-kubernetes-group-version-kind" ] ;
@@ -109,15 +109,15 @@ public string GetClassName(Dictionary<string, object> groupVersionKind)
109109 return classNameMap [ $ "{ group } _{ kind } _{ version } "] ;
110110 }
111111
112- public string GetClassName ( JsonSchema4 definition )
112+ public string GetClassName ( JsonSchema definition )
113113 {
114114 var groupVersionKindElements = ( object [ ] ) definition . ExtensionData [ "x-kubernetes-group-version-kind" ] ;
115115 var groupVersionKind = ( Dictionary < string , object > ) groupVersionKindElements [ 0 ] ;
116116
117117 return GetClassName ( groupVersionKind ) ;
118118 }
119119
120- public string GetClassNameForSchemaDefinition ( JsonSchema4 definition )
120+ public string GetClassNameForSchemaDefinition ( JsonSchema definition )
121121 {
122122 if ( definition . ExtensionData != null &&
123123 definition . ExtensionData . ContainsKey ( "x-kubernetes-group-version-kind" ) )
@@ -144,7 +144,7 @@ public string GetClassNameForSchemaDefinition(JsonSchema4 definition)
144144 return $ "{ group } { version } { entityName } ". ToPascalCase ( ) ;
145145 }
146146
147- private static Dictionary < JsonSchema4 , string > InitSchemaToNameCooked ( SwaggerDocument swaggercooked )
147+ private static Dictionary < JsonSchema , string > InitSchemaToNameCooked ( OpenApiDocument swaggercooked )
148148 {
149149 return swaggercooked . Definitions . ToDictionary ( x => x . Value , x => x . Key . Replace ( "." , "" ) . ToPascalCase ( ) ) ;
150150 }
0 commit comments