File tree Expand file tree Collapse file tree
src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ public class SchemaRepository(string documentName = null)
88
99 public string DocumentName { get ; } = documentName ;
1010
11- public Dictionary < string , IOpenApiSchema > Schemas { get ; private set ; } = [ ] ;
11+ public Dictionary < string , IOpenApiSchema > Schemas { get ; } = [ ] ;
1212
1313 public void RegisterType ( Type type , string schemaId )
1414 {
@@ -24,16 +24,17 @@ public void RegisterType(Type type, string schemaId)
2424 _reservedIds . Add ( type , schemaId ) ;
2525 }
2626
27- public bool TryLookupByType ( Type type , out OpenApiSchemaReference referenceSchema )
27+ public bool TryLookupByType ( Type type , [ System . Diagnostics . CodeAnalysis . NotNullWhen ( true ) ] out OpenApiSchemaReference referenceSchema )
2828 {
29- if ( _reservedIds . TryGetValue ( type , out string schemaId ) )
29+ referenceSchema = null ;
30+ bool result = _reservedIds . TryGetValue ( type , out string schemaId ) ;
31+
32+ if ( result )
3033 {
3134 referenceSchema = new OpenApiSchemaReference ( schemaId ) ;
32- return true ;
3335 }
3436
35- referenceSchema = null ;
36- return false ;
37+ return result ;
3738 }
3839
3940 public OpenApiSchemaReference AddDefinition ( string schemaId , OpenApiSchema schema )
You can’t perform that action at this time.
0 commit comments