@@ -36,17 +36,20 @@ public static class OpenApiTypeMapper
3636 /// <returns></returns>
3737 public static string [ ] ToIdentifiers ( this JsonSchemaType schemaType )
3838 {
39- var types = new List < string > ( ) ;
40-
41- if ( schemaType . HasFlag ( JsonSchemaType . Boolean ) ) types . Add ( "boolean" ) ;
42- if ( schemaType . HasFlag ( JsonSchemaType . Integer ) ) types . Add ( "integer" ) ;
43- if ( schemaType . HasFlag ( JsonSchemaType . Number ) ) types . Add ( "number" ) ;
44- if ( schemaType . HasFlag ( JsonSchemaType . String ) ) types . Add ( "string" ) ;
45- if ( schemaType . HasFlag ( JsonSchemaType . Object ) ) types . Add ( "object" ) ;
46- if ( schemaType . HasFlag ( JsonSchemaType . Array ) ) types . Add ( "array" ) ;
47- if ( schemaType . HasFlag ( JsonSchemaType . Null ) ) types . Add ( "null" ) ;
48-
49- return types . ToArray ( ) ;
39+ return schemaType . ToIdentifiersInternal ( ) . ToArray ( ) ;
40+ }
41+ private static readonly Dictionary < JsonSchemaType , string > allSchemaTypes = [
42+ { JsonSchemaType . Boolean , "boolean" } ,
43+ { JsonSchemaType . Integer , "integer" } ,
44+ { JsonSchemaType . Number , "number" } ,
45+ { JsonSchemaType . String , "string" } ,
46+ { JsonSchemaType . Object , "object" } ,
47+ { JsonSchemaType . Array , "array" } ,
48+ { JsonSchemaType . Null , "null" } ,
49+ ] ;
50+ private static IEnumerable < string > ToIdentifiersInternal ( this JsonSchemaType schemaType )
51+ {
52+ return allSchemaTypes . Where ( kvp => schemaType . HasFlag ( kvp . Key ) ) . Select ( static kvp => kvp . Value ) ;
5053 }
5154
5255 /// <summary>
0 commit comments