@@ -12,37 +12,44 @@ public static InterfaceData PrepareData(
1212 {
1313 interfaceSymbol = interfaceSymbol ?? throw new ArgumentNullException ( nameof ( interfaceSymbol ) ) ;
1414 attributeData = attributeData ?? throw new ArgumentNullException ( nameof ( attributeData ) ) ;
15-
15+
16+ var isStrict = attributeData . NamedArguments . FirstOrDefault ( x => x . Key == "Strict" ) . Value . Value is bool strict &&
17+ strict ;
1618 var methods = interfaceSymbol
1719 . GetMembers ( )
1820 . OfType < IMethodSymbol > ( )
1921 . Where ( static x => x . MethodKind == MethodKind . Ordinary )
20- . Select ( x => new MethodData (
21- Name : x . Name ,
22- Description : GetDescription ( x ) ,
23- IsAsync : x . IsAsync || x . ReturnType . Name == "Task" ,
24- IsVoid : x . ReturnsVoid ,
25- IsStrict : attributeData . NamedArguments . FirstOrDefault ( x => x . Key == "Strict" ) . Value . Value is bool strict && strict ,
26- Parameters : new OpenApiSchema (
22+ . Select ( x =>
23+ {
24+ var parameters = x . Parameters
25+ . Where ( static x => x . Type . MetadataName != "CancellationToken" )
26+ . ToArray ( ) ;
27+
28+ return new MethodData (
2729 Name : x . Name ,
2830 Description : GetDescription ( x ) ,
29- Type : "object" ,
30- SchemaType : "object" ,
31- Properties :
32- x . Parameters
33- . Where ( static x => x . Type . MetadataName != "CancellationToken" )
34- . Select ( static x => ToParameterData (
35- typeSymbol : x . Type ,
36- name : x . Name ,
37- description : GetDescription ( x ) ,
38- isRequired : ! x . IsOptional ) )
39- . ToArray ( ) ,
40- EnumValues : Array . Empty < string > ( ) ,
41- IsNullable : false ,
42- IsRequired : true ,
43- Format : null ,
44- ArrayItem : Array . Empty < OpenApiSchema > ( ) ,
45- DefaultValue : string . Empty ) ) )
31+ IsAsync : x . IsAsync || x . ReturnType . Name == "Task" ,
32+ IsVoid : x . ReturnsVoid ,
33+ IsStrict : isStrict ,
34+ Parameters : new OpenApiSchema (
35+ Name : x . Name ,
36+ Description : GetDescription ( x ) ,
37+ Type : "object" ,
38+ SchemaType : "object" ,
39+ Properties : parameters
40+ . Select ( y => ToParameterData (
41+ typeSymbol : y . Type ,
42+ name : y . Name ,
43+ description : GetDescription ( y ) ,
44+ isRequired : isStrict || ! y . IsOptional ) )
45+ . ToArray ( ) ,
46+ EnumValues : Array . Empty < string > ( ) ,
47+ IsNullable : false ,
48+ IsRequired : true ,
49+ Format : null ,
50+ ArrayItem : Array . Empty < OpenApiSchema > ( ) ,
51+ DefaultValue : string . Empty ) ) ;
52+ } )
4653 . ToArray ( ) ;
4754
4855 return new InterfaceData (
0 commit comments