File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed
src/Microsoft.OpenApi.Readers Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 1
1
<Project Sdk =" Microsoft.NET.Sdk" >
2
2
<PropertyGroup >
3
3
<TargetFrameworks >netstandard2.0</TargetFrameworks >
4
+ <LangVersion >9.0</LangVersion >
4
5
<GeneratePackageOnBuild >true</GeneratePackageOnBuild >
5
6
<PackageIconUrl >http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl >
6
7
<PackageProjectUrl >https://github.com/Microsoft/OpenAPI.NET</PackageProjectUrl >
Original file line number Diff line number Diff line change 1
- // Copyright (c) Microsoft Corporation. All rights reserved.
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
4
using System . Collections . Generic ;
@@ -29,7 +29,7 @@ private static void ParseMap<T>(
29
29
return ;
30
30
}
31
31
32
- var allFields = fixedFieldMap . Keys . Union ( mapNode . Select ( x => x . Name ) ) ;
32
+ var allFields = fixedFieldMap . Keys . Union ( mapNode . Select ( static x => x . Name ) ) ;
33
33
foreach ( var propertyNode in allFields )
34
34
{
35
35
mapNode [ propertyNode ] ? . ParseField ( domainObject , fixedFieldMap , patternFieldMap ) ;
@@ -78,16 +78,18 @@ private static void ProcessAnyListFields<T>(
78
78
var newProperty = new List < IOpenApiAny > ( ) ;
79
79
80
80
mapNode . Context . StartObject ( anyListFieldName ) ;
81
-
82
- var list = anyListFieldMap [ anyListFieldName ] ? . PropertyGetter ( domainObject ) ;
83
- if ( list != null )
81
+ if ( anyListFieldMap . TryGetValue ( anyListFieldName , out var fieldName ) )
84
82
{
85
- foreach ( var propertyElement in list )
83
+ var list = fieldName . PropertyGetter ( domainObject ) ;
84
+ if ( list != null )
86
85
{
87
- newProperty . Add (
88
- OpenApiAnyConverter . GetSpecificOpenApiAny (
89
- propertyElement ,
90
- anyListFieldMap [ anyListFieldName ] . SchemaGetter ( domainObject ) ) ) ;
86
+ foreach ( var propertyElement in list )
87
+ {
88
+ newProperty . Add (
89
+ OpenApiAnyConverter . GetSpecificOpenApiAny (
90
+ propertyElement ,
91
+ anyListFieldMap [ anyListFieldName ] . SchemaGetter ( domainObject ) ) ) ;
92
+ }
91
93
}
92
94
}
93
95
You can’t perform that action at this time.
0 commit comments