diff --git a/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.Descriptions-report.json b/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.Descriptions-report.json index 08e7c6c92..14e8fb356 100644 --- a/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.Descriptions-report.json +++ b/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.Descriptions-report.json @@ -1 +1,1182 @@ -{"Title":"performance.Descriptions-20250514-154213","HostEnvironmentInfo":{"BenchmarkDotNetCaption":"BenchmarkDotNet","BenchmarkDotNetVersion":"0.14.0","OsVersion":"Windows 11 (10.0.26100.3981)","ProcessorName":"11th Gen Intel Core i7-1185G7 3.00GHz","PhysicalProcessorCount":1,"PhysicalCoreCount":4,"LogicalCoreCount":8,"RuntimeVersion":".NET 8.0.16 (8.0.1625.21506)","Architecture":"X64","HasAttachedDebugger":false,"HasRyuJit":true,"Configuration":"RELEASE","DotNetCliVersion":"8.0.409","ChronometerFrequency":{"Hertz":10000000},"HardwareTimerKind":"Unknown"},"Benchmarks":[{"DisplayInfo":"Descriptions.PetStoreYaml: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)","Namespace":"performance","Type":"Descriptions","Method":"PetStoreYaml","MethodTitle":"PetStoreYaml","Parameters":"","FullName":"performance.Descriptions.PetStoreYaml","HardwareIntrinsics":"AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256","Statistics":{"OriginalValues":[465362.5,466458.984375,478982.8125],"N":3,"Min":465362.5,"LowerFence":455695.5078125,"Q1":465910.7421875,"Median":466458.984375,"Mean":470268.0989583333,"Q3":472720.8984375,"UpperFence":482936.1328125,"Max":478982.8125,"InterquartileRange":6810.15625,"LowerOutliers":[],"UpperOutliers":[],"AllOutliers":[],"StandardError":4368.838273543516,"Variance":57260243.58113606,"StandardDeviation":7567.049859828866,"Skewness":0.37582823758451755,"Kurtosis":0.6666666666666706,"ConfidenceInterval":{"N":3,"Mean":470268.0989583333,"StandardError":4368.838273543516,"Level":12,"Margin":138051.1584827056,"Lower":332216.9404756277,"Upper":608319.257441039},"Percentiles":{"P0":465362.5,"P25":465910.7421875,"P50":466458.984375,"P67":470717.0859375,"P80":473973.28125,"P85":475225.6640625,"P90":476478.046875,"P95":477730.4296875,"P100":478982.8125}},"Memory":{"Gen0Collections":15,"Gen1Collections":3,"Gen2Collections":0,"TotalOperations":256,"BytesAllocatedPerOperation":389660},"Measurements":[{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":210500},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":82571800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":1,"Operations":2,"Nanoseconds":3872500},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":2,"Operations":3,"Nanoseconds":6115500},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":3,"Operations":4,"Nanoseconds":7331400},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":4,"Operations":5,"Nanoseconds":9186500},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":5,"Operations":6,"Nanoseconds":12504800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":6,"Operations":7,"Nanoseconds":14797700},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":7,"Operations":8,"Nanoseconds":14768200},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":8,"Operations":9,"Nanoseconds":18440400},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":9,"Operations":10,"Nanoseconds":21516300},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":10,"Operations":11,"Nanoseconds":20485000},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":11,"Operations":12,"Nanoseconds":25991800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":12,"Operations":13,"Nanoseconds":24538900},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":13,"Operations":14,"Nanoseconds":30255300},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":14,"Operations":15,"Nanoseconds":27933500},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":15,"Operations":16,"Nanoseconds":31059700},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":16,"Operations":32,"Nanoseconds":63905200},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":17,"Operations":64,"Nanoseconds":111009300},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":18,"Operations":128,"Nanoseconds":268925200},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":19,"Operations":256,"Nanoseconds":716804800},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":1,"Operations":256,"Nanoseconds":220782800},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":2,"Operations":256,"Nanoseconds":174724700},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":3,"Operations":256,"Nanoseconds":127336100},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":1,"Operations":256,"Nanoseconds":119132800},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":2,"Operations":256,"Nanoseconds":119413500},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":3,"Operations":256,"Nanoseconds":122619600},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":1,"Operations":256,"Nanoseconds":119132800},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":2,"Operations":256,"Nanoseconds":119413500},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":3,"Operations":256,"Nanoseconds":122619600}],"Metrics":[{"Value":58.59375,"Descriptor":{"Id":"Gen0Collects","DisplayName":"Gen0","Legend":"GC Generation 0 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":0}},{"Value":11.71875,"Descriptor":{"Id":"Gen1Collects","DisplayName":"Gen1","Legend":"GC Generation 1 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":1}},{"Value":0,"Descriptor":{"Id":"Gen2Collects","DisplayName":"Gen2","Legend":"GC Generation 2 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":2}},{"Value":389660,"Descriptor":{"Id":"Allocated Memory","DisplayName":"Allocated","Legend":"Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)","NumberFormat":"0.##","UnitType":2,"Unit":"B","TheGreaterTheBetter":false,"PriorityInCategory":3}}]},{"DisplayInfo":"Descriptions.PetStoreJson: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)","Namespace":"performance","Type":"Descriptions","Method":"PetStoreJson","MethodTitle":"PetStoreJson","Parameters":"","FullName":"performance.Descriptions.PetStoreJson","HardwareIntrinsics":"AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256","Statistics":{"OriginalValues":[164686.81640625,164494.04296875,168749.0234375],"N":3,"Min":164494.04296875,"LowerFence":161399.1943359375,"Q1":164590.4296875,"Median":164686.81640625,"Mean":165976.62760416666,"Q3":166717.919921875,"UpperFence":169909.1552734375,"Max":168749.0234375,"InterquartileRange":2127.490234375,"LowerOutliers":[],"UpperOutliers":[],"AllOutliers":[],"StandardError":1387.3144791363893,"Variance":5773924.392064413,"StandardDeviation":2402.8991639401793,"Skewness":0.38211513228079363,"Kurtosis":0.6666666666666727,"ConfidenceInterval":{"N":3,"Mean":165976.62760416666,"StandardError":1387.3144791363893,"Level":12,"Margin":43837.82576352267,"Lower":122138.80184064398,"Upper":209814.45336768933},"Percentiles":{"P0":164494.04296875,"P25":164590.4296875,"P50":164686.81640625,"P67":166067.966796875,"P80":167124.140625,"P85":167530.361328125,"P90":167936.58203125,"P95":168342.802734375,"P100":168749.0234375}},"Memory":{"Gen0Collections":40,"Gen1Collections":9,"Gen2Collections":0,"TotalOperations":1024,"BytesAllocatedPerOperation":248489},"Measurements":[{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":229900},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":49778600},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":1,"Operations":2,"Nanoseconds":1747400},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":2,"Operations":3,"Nanoseconds":1888900},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":3,"Operations":4,"Nanoseconds":2252800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":4,"Operations":5,"Nanoseconds":3001800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":5,"Operations":6,"Nanoseconds":4090800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":6,"Operations":7,"Nanoseconds":4234800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":7,"Operations":8,"Nanoseconds":5649900},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":8,"Operations":9,"Nanoseconds":5566900},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":9,"Operations":10,"Nanoseconds":7057700},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":10,"Operations":11,"Nanoseconds":7532000},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":11,"Operations":12,"Nanoseconds":8156400},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":12,"Operations":13,"Nanoseconds":7620800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":13,"Operations":14,"Nanoseconds":8519200},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":14,"Operations":15,"Nanoseconds":10029200},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":15,"Operations":16,"Nanoseconds":10782300},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":16,"Operations":32,"Nanoseconds":19995000},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":17,"Operations":64,"Nanoseconds":40188000},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":18,"Operations":128,"Nanoseconds":74045000},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":19,"Operations":256,"Nanoseconds":146500400},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":20,"Operations":512,"Nanoseconds":305057600},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":21,"Operations":1024,"Nanoseconds":590308900},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":1,"Operations":1024,"Nanoseconds":476135100},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":2,"Operations":1024,"Nanoseconds":190273500},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":3,"Operations":1024,"Nanoseconds":170380100},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":1,"Operations":1024,"Nanoseconds":168639300},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":2,"Operations":1024,"Nanoseconds":168441900},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":3,"Operations":1024,"Nanoseconds":172799000},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":1,"Operations":1024,"Nanoseconds":168639300},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":2,"Operations":1024,"Nanoseconds":168441900},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":3,"Operations":1024,"Nanoseconds":172799000}],"Metrics":[{"Value":39.0625,"Descriptor":{"Id":"Gen0Collects","DisplayName":"Gen0","Legend":"GC Generation 0 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":0}},{"Value":8.7890625,"Descriptor":{"Id":"Gen1Collects","DisplayName":"Gen1","Legend":"GC Generation 1 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":1}},{"Value":0,"Descriptor":{"Id":"Gen2Collects","DisplayName":"Gen2","Legend":"GC Generation 2 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":2}},{"Value":248489,"Descriptor":{"Id":"Allocated Memory","DisplayName":"Allocated","Legend":"Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)","NumberFormat":"0.##","UnitType":2,"Unit":"B","TheGreaterTheBetter":false,"PriorityInCategory":3}}]},{"DisplayInfo":"Descriptions.GHESYaml: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)","Namespace":"performance","Type":"Descriptions","Method":"GHESYaml","MethodTitle":"GHESYaml","Parameters":"","FullName":"performance.Descriptions.GHESYaml","HardwareIntrinsics":"AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256","Statistics":{"OriginalValues":[945590600,929477300,871151200],"N":3,"Min":871151200,"LowerFence":844484700,"Q1":900314250,"Median":929477300,"Mean":915406366.6666666,"Q3":937533950,"UpperFence":993363500,"Max":945590600,"InterquartileRange":37219700,"LowerOutliers":[],"UpperOutliers":[],"AllOutliers":[],"StandardError":22611202.546107784,"Variance":1533799441743333.5,"StandardDeviation":39163751.63008944,"Skewness":-0.3129062028807021,"Kurtosis":0.6666666666666653,"ConfidenceInterval":{"N":3,"Mean":915406366.6666666,"StandardError":22611202.546107784,"Level":12,"Margin":714492620.4021431,"Lower":200913746.2645235,"Upper":1629898987.0688097},"Percentiles":{"P0":871151200,"P25":900314250,"P50":929477300,"P67":934955822,"P80":939145280,"P85":940756610,"P90":942367940,"P95":943979270,"P100":945590600}},"Memory":{"Gen0Collections":68,"Gen1Collections":22,"Gen2Collections":4,"TotalOperations":1,"BytesAllocatedPerOperation":405300208},"Measurements":[{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":238300},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":1805606300},{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":600},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":1068747500},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":998100500},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":922151200},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":915421700},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":945590600},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":929477300},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":871151200},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":945590600},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":929477300},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":871151200}],"Metrics":[{"Value":68000,"Descriptor":{"Id":"Gen0Collects","DisplayName":"Gen0","Legend":"GC Generation 0 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":0}},{"Value":22000,"Descriptor":{"Id":"Gen1Collects","DisplayName":"Gen1","Legend":"GC Generation 1 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":1}},{"Value":4000,"Descriptor":{"Id":"Gen2Collects","DisplayName":"Gen2","Legend":"GC Generation 2 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":2}},{"Value":405300208,"Descriptor":{"Id":"Allocated Memory","DisplayName":"Allocated","Legend":"Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)","NumberFormat":"0.##","UnitType":2,"Unit":"B","TheGreaterTheBetter":false,"PriorityInCategory":3}}]},{"DisplayInfo":"Descriptions.GHESJson: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)","Namespace":"performance","Type":"Descriptions","Method":"GHESJson","MethodTitle":"GHESJson","Parameters":"","FullName":"performance.Descriptions.GHESJson","HardwareIntrinsics":"AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256","Statistics":{"OriginalValues":[486026300,468580000,457221900],"N":3,"Min":457221900,"LowerFence":441297650,"Q1":462900950,"Median":468580000,"Mean":470609400,"Q3":477303150,"UpperFence":498906450,"Max":486026300,"InterquartileRange":14402200,"LowerOutliers":[],"UpperOutliers":[],"AllOutliers":[],"StandardError":8376797.580420177,"Variance":210512213110000,"StandardDeviation":14509039.014007784,"Skewness":0.13713498071671384,"Kurtosis":0.6666666666666666,"ConfidenceInterval":{"N":3,"Mean":470609400,"StandardError":8376797.580420177,"Level":12,"Margin":264698882.84836096,"Lower":205910517.15163904,"Upper":735308282.848361},"Percentiles":{"P0":457221900,"P25":462900950,"P50":468580000,"P67":474511742,"P80":479047780,"P85":480792410,"P90":482537040,"P95":484281670,"P100":486026300}},"Memory":{"Gen0Collections":42,"Gen1Collections":15,"Gen2Collections":3,"TotalOperations":1,"BytesAllocatedPerOperation":263444936},"Measurements":[{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":609500},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":1017050000},{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":600},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":836928600},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":626599200},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":501412100},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":495906300},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":486026300},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":468580000},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":457221900},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":486026300},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":468580000},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":457221900}],"Metrics":[{"Value":42000,"Descriptor":{"Id":"Gen0Collects","DisplayName":"Gen0","Legend":"GC Generation 0 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":0}},{"Value":15000,"Descriptor":{"Id":"Gen1Collects","DisplayName":"Gen1","Legend":"GC Generation 1 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":1}},{"Value":3000,"Descriptor":{"Id":"Gen2Collects","DisplayName":"Gen2","Legend":"GC Generation 2 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":2}},{"Value":263444936,"Descriptor":{"Id":"Allocated Memory","DisplayName":"Allocated","Legend":"Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)","NumberFormat":"0.##","UnitType":2,"Unit":"B","TheGreaterTheBetter":false,"PriorityInCategory":3}}]}]} +{ + "Title": "performance.Descriptions-20250514-154213", + "HostEnvironmentInfo": { + "BenchmarkDotNetCaption": "BenchmarkDotNet", + "BenchmarkDotNetVersion": "0.14.0", + "OsVersion": "Windows 11 (10.0.26100.3981)", + "ProcessorName": "11th Gen Intel Core i7-1185G7 3.00GHz", + "PhysicalProcessorCount": 1, + "PhysicalCoreCount": 4, + "LogicalCoreCount": 8, + "RuntimeVersion": ".NET 8.0.16 (8.0.1625.21506)", + "Architecture": "X64", + "HasAttachedDebugger": false, + "HasRyuJit": true, + "Configuration": "RELEASE", + "DotNetCliVersion": "8.0.409", + "ChronometerFrequency": { "Hertz": 10000000 }, + "HardwareTimerKind": "Unknown" + }, + "Benchmarks": [ + { + "DisplayInfo": "Descriptions.PetStoreYaml: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)", + "Namespace": "performance", + "Type": "Descriptions", + "Method": "PetStoreYaml", + "MethodTitle": "PetStoreYaml", + "Parameters": "", + "FullName": "performance.Descriptions.PetStoreYaml", + "HardwareIntrinsics": "AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256", + "Statistics": { + "OriginalValues": [ 465362.5, 466458.984375, 478982.8125 ], + "N": 3, + "Min": 465362.5, + "LowerFence": 455695.5078125, + "Q1": 465910.7421875, + "Median": 466458.984375, + "Mean": 470268.0989583333, + "Q3": 472720.8984375, + "UpperFence": 482936.1328125, + "Max": 478982.8125, + "InterquartileRange": 6810.15625, + "LowerOutliers": [], + "UpperOutliers": [], + "AllOutliers": [], + "StandardError": 4368.838273543516, + "Variance": 57260243.58113606, + "StandardDeviation": 7567.049859828866, + "Skewness": 0.37582823758451755, + "Kurtosis": 0.6666666666666706, + "ConfidenceInterval": { + "N": 3, + "Mean": 470268.0989583333, + "StandardError": 4368.838273543516, + "Level": 12, + "Margin": 138051.1584827056, + "Lower": 332216.9404756277, + "Upper": 608319.257441039 + }, + "Percentiles": { + "P0": 465362.5, + "P25": 465910.7421875, + "P50": 466458.984375, + "P67": 470717.0859375, + "P80": 473973.28125, + "P85": 475225.6640625, + "P90": 476478.046875, + "P95": 477730.4296875, + "P100": 478982.8125 + } + }, + "Memory": { + "Gen0Collections": 15, + "Gen1Collections": 3, + "Gen2Collections": 0, + "TotalOperations": 256, + "BytesAllocatedPerOperation": 396052 + }, + "Measurements": [ + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 210500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 82571800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 2, + "Nanoseconds": 3872500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 3, + "Nanoseconds": 6115500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 4, + "Nanoseconds": 7331400 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 4, + "Operations": 5, + "Nanoseconds": 9186500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 5, + "Operations": 6, + "Nanoseconds": 12504800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 6, + "Operations": 7, + "Nanoseconds": 14797700 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 7, + "Operations": 8, + "Nanoseconds": 14768200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 8, + "Operations": 9, + "Nanoseconds": 18440400 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 9, + "Operations": 10, + "Nanoseconds": 21516300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 10, + "Operations": 11, + "Nanoseconds": 20485000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 11, + "Operations": 12, + "Nanoseconds": 25991800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 12, + "Operations": 13, + "Nanoseconds": 24538900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 13, + "Operations": 14, + "Nanoseconds": 30255300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 14, + "Operations": 15, + "Nanoseconds": 27933500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 15, + "Operations": 16, + "Nanoseconds": 31059700 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 16, + "Operations": 32, + "Nanoseconds": 63905200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 17, + "Operations": 64, + "Nanoseconds": 111009300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 18, + "Operations": 128, + "Nanoseconds": 268925200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 19, + "Operations": 256, + "Nanoseconds": 716804800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 256, + "Nanoseconds": 220782800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 256, + "Nanoseconds": 174724700 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 256, + "Nanoseconds": 127336100 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 256, + "Nanoseconds": 119132800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 256, + "Nanoseconds": 119413500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 256, + "Nanoseconds": 122619600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 256, + "Nanoseconds": 119132800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 256, + "Nanoseconds": 119413500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 256, + "Nanoseconds": 122619600 + } + ], + "Metrics": [ + { + "Value": 58.59375, + "Descriptor": { + "Id": "Gen0Collects", + "DisplayName": "Gen0", + "Legend": "GC Generation 0 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 0 + } + }, + { + "Value": 11.71875, + "Descriptor": { + "Id": "Gen1Collects", + "DisplayName": "Gen1", + "Legend": "GC Generation 1 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 1 + } + }, + { + "Value": 0, + "Descriptor": { + "Id": "Gen2Collects", + "DisplayName": "Gen2", + "Legend": "GC Generation 2 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 2 + } + }, + { + "Value": 396052, + "Descriptor": { + "Id": "Allocated Memory", + "DisplayName": "Allocated", + "Legend": "Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)", + "NumberFormat": "0.##", + "UnitType": 2, + "Unit": "B", + "TheGreaterTheBetter": false, + "PriorityInCategory": 3 + } + } + ] + }, + { + "DisplayInfo": "Descriptions.PetStoreJson: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)", + "Namespace": "performance", + "Type": "Descriptions", + "Method": "PetStoreJson", + "MethodTitle": "PetStoreJson", + "Parameters": "", + "FullName": "performance.Descriptions.PetStoreJson", + "HardwareIntrinsics": "AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256", + "Statistics": { + "OriginalValues": [ 164686.81640625, 164494.04296875, 168749.0234375 ], + "N": 3, + "Min": 164494.04296875, + "LowerFence": 161399.1943359375, + "Q1": 164590.4296875, + "Median": 164686.81640625, + "Mean": 165976.62760416666, + "Q3": 166717.919921875, + "UpperFence": 169909.1552734375, + "Max": 168749.0234375, + "InterquartileRange": 2127.490234375, + "LowerOutliers": [], + "UpperOutliers": [], + "AllOutliers": [], + "StandardError": 1387.3144791363893, + "Variance": 5773924.392064413, + "StandardDeviation": 2402.8991639401793, + "Skewness": 0.38211513228079363, + "Kurtosis": 0.6666666666666727, + "ConfidenceInterval": { + "N": 3, + "Mean": 165976.62760416666, + "StandardError": 1387.3144791363893, + "Level": 12, + "Margin": 43837.82576352267, + "Lower": 122138.80184064398, + "Upper": 209814.45336768933 + }, + "Percentiles": { + "P0": 164494.04296875, + "P25": 164590.4296875, + "P50": 164686.81640625, + "P67": 166067.966796875, + "P80": 167124.140625, + "P85": 167530.361328125, + "P90": 167936.58203125, + "P95": 168342.802734375, + "P100": 168749.0234375 + } + }, + "Memory": { + "Gen0Collections": 40, + "Gen1Collections": 9, + "Gen2Collections": 0, + "TotalOperations": 1024, + "BytesAllocatedPerOperation": 254585 + }, + "Measurements": [ + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 229900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 49778600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 2, + "Nanoseconds": 1747400 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 3, + "Nanoseconds": 1888900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 4, + "Nanoseconds": 2252800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 4, + "Operations": 5, + "Nanoseconds": 3001800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 5, + "Operations": 6, + "Nanoseconds": 4090800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 6, + "Operations": 7, + "Nanoseconds": 4234800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 7, + "Operations": 8, + "Nanoseconds": 5649900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 8, + "Operations": 9, + "Nanoseconds": 5566900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 9, + "Operations": 10, + "Nanoseconds": 7057700 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 10, + "Operations": 11, + "Nanoseconds": 7532000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 11, + "Operations": 12, + "Nanoseconds": 8156400 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 12, + "Operations": 13, + "Nanoseconds": 7620800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 13, + "Operations": 14, + "Nanoseconds": 8519200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 14, + "Operations": 15, + "Nanoseconds": 10029200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 15, + "Operations": 16, + "Nanoseconds": 10782300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 16, + "Operations": 32, + "Nanoseconds": 19995000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 17, + "Operations": 64, + "Nanoseconds": 40188000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 18, + "Operations": 128, + "Nanoseconds": 74045000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 19, + "Operations": 256, + "Nanoseconds": 146500400 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 20, + "Operations": 512, + "Nanoseconds": 305057600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 21, + "Operations": 1024, + "Nanoseconds": 590308900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1024, + "Nanoseconds": 476135100 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1024, + "Nanoseconds": 190273500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1024, + "Nanoseconds": 170380100 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1024, + "Nanoseconds": 168639300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1024, + "Nanoseconds": 168441900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1024, + "Nanoseconds": 172799000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1024, + "Nanoseconds": 168639300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1024, + "Nanoseconds": 168441900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1024, + "Nanoseconds": 172799000 + } + ], + "Metrics": [ + { + "Value": 39.0625, + "Descriptor": { + "Id": "Gen0Collects", + "DisplayName": "Gen0", + "Legend": "GC Generation 0 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 0 + } + }, + { + "Value": 8.7890625, + "Descriptor": { + "Id": "Gen1Collects", + "DisplayName": "Gen1", + "Legend": "GC Generation 1 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 1 + } + }, + { + "Value": 0, + "Descriptor": { + "Id": "Gen2Collects", + "DisplayName": "Gen2", + "Legend": "GC Generation 2 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 2 + } + }, + { + "Value": 254585, + "Descriptor": { + "Id": "Allocated Memory", + "DisplayName": "Allocated", + "Legend": "Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)", + "NumberFormat": "0.##", + "UnitType": 2, + "Unit": "B", + "TheGreaterTheBetter": false, + "PriorityInCategory": 3 + } + } + ] + }, + { + "DisplayInfo": "Descriptions.GHESYaml: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)", + "Namespace": "performance", + "Type": "Descriptions", + "Method": "GHESYaml", + "MethodTitle": "GHESYaml", + "Parameters": "", + "FullName": "performance.Descriptions.GHESYaml", + "HardwareIntrinsics": "AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256", + "Statistics": { + "OriginalValues": [ 945590600, 929477300, 871151200 ], + "N": 3, + "Min": 871151200, + "LowerFence": 844484700, + "Q1": 900314250, + "Median": 929477300, + "Mean": 915406366.6666666, + "Q3": 937533950, + "UpperFence": 993363500, + "Max": 945590600, + "InterquartileRange": 37219700, + "LowerOutliers": [], + "UpperOutliers": [], + "AllOutliers": [], + "StandardError": 22611202.546107784, + "Variance": 1533799441743333.5, + "StandardDeviation": 39163751.63008944, + "Skewness": -0.3129062028807021, + "Kurtosis": 0.6666666666666653, + "ConfidenceInterval": { + "N": 3, + "Mean": 915406366.6666666, + "StandardError": 22611202.546107784, + "Level": 12, + "Margin": 714492620.4021431, + "Lower": 200913746.2645235, + "Upper": 1629898987.0688097 + }, + "Percentiles": { + "P0": 871151200, + "P25": 900314250, + "P50": 929477300, + "P67": 934955822, + "P80": 939145280, + "P85": 940756610, + "P90": 942367940, + "P95": 943979270, + "P100": 945590600 + } + }, + "Memory": { + "Gen0Collections": 68, + "Gen1Collections": 22, + "Gen2Collections": 4, + "TotalOperations": 1, + "BytesAllocatedPerOperation": 409271848 + }, + "Measurements": [ + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 238300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 1805606300 + }, + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 1068747500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 998100500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 922151200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 915421700 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 945590600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 929477300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 871151200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 945590600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 929477300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 871151200 + } + ], + "Metrics": [ + { + "Value": 68000, + "Descriptor": { + "Id": "Gen0Collects", + "DisplayName": "Gen0", + "Legend": "GC Generation 0 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 0 + } + }, + { + "Value": 22000, + "Descriptor": { + "Id": "Gen1Collects", + "DisplayName": "Gen1", + "Legend": "GC Generation 1 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 1 + } + }, + { + "Value": 4000, + "Descriptor": { + "Id": "Gen2Collects", + "DisplayName": "Gen2", + "Legend": "GC Generation 2 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 2 + } + }, + { + "Value": 409271848, + "Descriptor": { + "Id": "Allocated Memory", + "DisplayName": "Allocated", + "Legend": "Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)", + "NumberFormat": "0.##", + "UnitType": 2, + "Unit": "B", + "TheGreaterTheBetter": false, + "PriorityInCategory": 3 + } + } + ] + }, + { + "DisplayInfo": "Descriptions.GHESJson: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)", + "Namespace": "performance", + "Type": "Descriptions", + "Method": "GHESJson", + "MethodTitle": "GHESJson", + "Parameters": "", + "FullName": "performance.Descriptions.GHESJson", + "HardwareIntrinsics": "AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256", + "Statistics": { + "OriginalValues": [ 486026300, 468580000, 457221900 ], + "N": 3, + "Min": 457221900, + "LowerFence": 441297650, + "Q1": 462900950, + "Median": 468580000, + "Mean": 470609400, + "Q3": 477303150, + "UpperFence": 498906450, + "Max": 486026300, + "InterquartileRange": 14402200, + "LowerOutliers": [], + "UpperOutliers": [], + "AllOutliers": [], + "StandardError": 8376797.580420177, + "Variance": 210512213110000, + "StandardDeviation": 14509039.014007784, + "Skewness": 0.13713498071671384, + "Kurtosis": 0.6666666666666666, + "ConfidenceInterval": { + "N": 3, + "Mean": 470609400, + "StandardError": 8376797.580420177, + "Level": 12, + "Margin": 264698882.84836096, + "Lower": 205910517.15163904, + "Upper": 735308282.848361 + }, + "Percentiles": { + "P0": 457221900, + "P25": 462900950, + "P50": 468580000, + "P67": 474511742, + "P80": 479047780, + "P85": 480792410, + "P90": 482537040, + "P95": 484281670, + "P100": 486026300 + } + }, + "Memory": { + "Gen0Collections": 42, + "Gen1Collections": 15, + "Gen2Collections": 3, + "TotalOperations": 1, + "BytesAllocatedPerOperation": 267416792 + }, + "Measurements": [ + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 609500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 1017050000 + }, + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 836928600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 626599200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 501412100 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 495906300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 486026300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 468580000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 457221900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 486026300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 468580000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 457221900 + } + ], + "Metrics": [ + { + "Value": 42000, + "Descriptor": { + "Id": "Gen0Collects", + "DisplayName": "Gen0", + "Legend": "GC Generation 0 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 0 + } + }, + { + "Value": 15000, + "Descriptor": { + "Id": "Gen1Collects", + "DisplayName": "Gen1", + "Legend": "GC Generation 1 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 1 + } + }, + { + "Value": 3000, + "Descriptor": { + "Id": "Gen2Collects", + "DisplayName": "Gen2", + "Legend": "GC Generation 2 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 2 + } + }, + { + "Value": 267416792, + "Descriptor": { + "Id": "Allocated Memory", + "DisplayName": "Allocated", + "Legend": "Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)", + "NumberFormat": "0.##", + "UnitType": 2, + "Unit": "B", + "TheGreaterTheBetter": false, + "PriorityInCategory": 3 + } + } + ] + } + ] +} diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs index 0801d1d49..1a98fd556 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs @@ -11,7 +11,7 @@ internal static class OpenApiExtensibleExtensions /// A dictionary of . /// The key corresponding to the . /// A value matching the provided extensionKey. Return null when extensionKey is not found. - internal static string GetExtension(this Dictionary extensions, string extensionKey) + internal static string GetExtension(this IDictionary extensions, string extensionKey) { if (extensions.TryGetValue(extensionKey, out var value) && value is JsonNodeExtension { Node: JsonValue castValue } && castValue.TryGetValue(out var stringValue)) { diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index a4614e583..bb4bc58d9 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -74,7 +74,7 @@ public override void Visit(OpenApiOperation operation) // Order matters. Resolve operationId. operationId = RemoveHashSuffix(operationId); if (operationTypeExtension.IsEquals("action") || operationTypeExtension.IsEquals("function")) - operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? []); + operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? new List()); operationId = SingularizeAndDeduplicateOperationId(operationId.SplitByChar('.')); operationId = ResolveODataCastOperationId(operationId); operationId = ResolveByRefOperationId(operationId); @@ -142,7 +142,7 @@ private static string RemoveHashSuffix(string operationId) return s_hashSuffixRegex.Match(operationId).Value; } - private static string RemoveKeyTypeSegment(string operationId, List parameters) + private static string RemoveKeyTypeSegment(string operationId, IList parameters) { var segments = operationId.SplitByChar('.'); foreach (var parameter in parameters) @@ -156,7 +156,7 @@ private static string RemoveKeyTypeSegment(string operationId, List parameters) + private static void ResolveFunctionParameters(IList parameters) { foreach (var parameter in parameters.OfType().Where(static p => p.Content?.Count > 0)) { diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index d12d9bdfb..f12026d5b 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -24,7 +24,7 @@ public override void Visit(IOpenApiSchema schema) public int HeaderCount { get; set; } - public override void Visit(Dictionary headers) + public override void Visit(IDictionary headers) { HeaderCount++; } diff --git a/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs b/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs index 7e9c9e77e..32cb28379 100644 --- a/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs @@ -24,7 +24,7 @@ public override void Visit(IOpenApiSchema schema) public int HeaderCount { get; set; } - public override void Visit(Dictionary headers) + public override void Visit(IDictionary headers) { HeaderCount++; } diff --git a/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs b/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs new file mode 100644 index 000000000..303c8ffed --- /dev/null +++ b/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.OpenApi +{ + /// + /// Dictionary extension methods + /// + internal static class CollectionExtensions + { + /// + /// Returns a new dictionary with entries sorted by key using a custom comparer. + /// + internal static IDictionary Sort( + this IDictionary source, + IComparer comparer) + where TKey : notnull + { +#if NET7_0_OR_GREATER + ArgumentNullException.ThrowIfNull(nameof(source)); + ArgumentNullException.ThrowIfNull(nameof(comparer)); +#else + if (source == null) + throw new ArgumentNullException(nameof(source)); + if (comparer == null) + throw new ArgumentNullException(nameof(comparer)); +#endif + return source.OrderBy(kvp => kvp.Key, comparer) + .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + } + + /// + /// Sorts any IEnumerable using the specified comparer and returns a List. + /// + internal static List Sort(this IEnumerable source, IComparer comparer) + { +#if NET7_0_OR_GREATER + ArgumentNullException.ThrowIfNull(source); + ArgumentNullException.ThrowIfNull(comparer); +#else + if (source == null) + throw new ArgumentNullException(nameof(source)); + if (comparer == null) + throw new ArgumentNullException(nameof(comparer)); +#endif + return source.OrderBy(item => item, comparer).ToList(); + } + } +} diff --git a/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs index d0bd11db7..266e36020 100644 --- a/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using System; +using System.Collections.Generic; namespace Microsoft.OpenApi { @@ -28,7 +29,7 @@ public static void AddExtension(this T element, string name, IOpenApiExtensio throw new OpenApiException(string.Format(SRResource.ExtensionFieldNameMustBeginWithXDash, name)); } - element.Extensions ??= []; + element.Extensions ??= new Dictionary(); element.Extensions[name] = Utils.CheckArgumentNull(any); } } diff --git a/src/Microsoft.OpenApi/Interfaces/IMetadataContainer.cs b/src/Microsoft.OpenApi/Interfaces/IMetadataContainer.cs index d94ca2e0e..529b9fd2c 100644 --- a/src/Microsoft.OpenApi/Interfaces/IMetadataContainer.cs +++ b/src/Microsoft.OpenApi/Interfaces/IMetadataContainer.cs @@ -14,5 +14,5 @@ public interface IMetadataContainer /// A collection of properties associated with the current OpenAPI element to be used by the application. /// Metadata are NOT (de)serialized with the schema and can be used for custom properties. /// - Dictionary? Metadata { get; set; } + IDictionary? Metadata { get; set; } } diff --git a/src/Microsoft.OpenApi/Interfaces/IOpenApiExtensible.cs b/src/Microsoft.OpenApi/Interfaces/IOpenApiExtensible.cs index ad0416c9d..349a48e6c 100644 --- a/src/Microsoft.OpenApi/Interfaces/IOpenApiExtensible.cs +++ b/src/Microsoft.OpenApi/Interfaces/IOpenApiExtensible.cs @@ -13,6 +13,6 @@ public interface IOpenApiExtensible : IOpenApiElement /// /// Specification extensions. /// - Dictionary? Extensions { get; set; } + IDictionary? Extensions { get; set; } } } diff --git a/src/Microsoft.OpenApi/Interfaces/IOpenApiReadOnlyExtensible.cs b/src/Microsoft.OpenApi/Interfaces/IOpenApiReadOnlyExtensible.cs index 53051a242..fac742d7d 100644 --- a/src/Microsoft.OpenApi/Interfaces/IOpenApiReadOnlyExtensible.cs +++ b/src/Microsoft.OpenApi/Interfaces/IOpenApiReadOnlyExtensible.cs @@ -10,6 +10,6 @@ public interface IOpenApiReadOnlyExtensible /// /// Specification extensions. /// - Dictionary? Extensions { get; } + IDictionary? Extensions { get; } } diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiHeader.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiHeader.cs index 4db52cd61..46f8666aa 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiHeader.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiHeader.cs @@ -54,11 +54,11 @@ public interface IOpenApiHeader : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// /// Examples of the media type. /// - public Dictionary? Examples { get; } + public IDictionary? Examples { get; } /// /// A map containing the representations for the header. /// - public Dictionary? Content { get; } + public IDictionary? Content { get; } } diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiLink.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiLink.cs index 1ba6a4b65..09ac35c2f 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiLink.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiLink.cs @@ -23,7 +23,7 @@ public interface IOpenApiLink : IOpenApiDescribedElement, IOpenApiReadOnlyExtens /// /// A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. /// - public Dictionary? Parameters { get; } + public IDictionary? Parameters { get; } /// /// A literal value or {expression} to use as a request body when calling the target operation. diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiParameter.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiParameter.cs index c940f2918..17db255df 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiParameter.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiParameter.cs @@ -80,7 +80,7 @@ public interface IOpenApiParameter : IOpenApiDescribedElement, IOpenApiReadOnlyE /// Furthermore, if referencing a schema which contains an example, /// the examples value SHALL override the example provided by the schema. /// - public Dictionary? Examples { get; } + public IDictionary? Examples { get; } /// /// Example of the media type. The example SHOULD match the specified schema and encoding properties @@ -101,5 +101,5 @@ public interface IOpenApiParameter : IOpenApiDescribedElement, IOpenApiReadOnlyE /// When example or examples are provided in conjunction with the schema object, /// the example MUST follow the prescribed serialization strategy for the parameter. /// - public Dictionary? Content { get; } + public IDictionary? Content { get; } } diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiPathItem.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiPathItem.cs index b9cb5c382..d4bf012fc 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiPathItem.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiPathItem.cs @@ -18,11 +18,11 @@ public interface IOpenApiPathItem : IOpenApiDescribedElement, IOpenApiSummarized /// /// An alternative server array to service all operations in this path. /// - public List? Servers { get; } + public IList? Servers { get; } /// /// A list of parameters that are applicable for all the operations described under this path. /// These parameters can be overridden at the operation level, but cannot be removed there. /// - public List? Parameters { get; } + public IList? Parameters { get; } } diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiRequestBody.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiRequestBody.cs index 361dc8d46..dfe1e1715 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiRequestBody.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiRequestBody.cs @@ -17,7 +17,7 @@ public interface IOpenApiRequestBody : IOpenApiDescribedElement, IOpenApiReadOnl /// REQUIRED. The content of the request body. The key is a media type or media type range and the value describes it. /// For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* /// - public Dictionary? Content { get; } + public IDictionary? Content { get; } /// /// Converts the request body to a body parameter in preparation for a v2 serialization. /// diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiResponse.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiResponse.cs index e4d19a1f0..dfddd7838 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiResponse.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiResponse.cs @@ -11,18 +11,18 @@ public interface IOpenApiResponse : IOpenApiDescribedElement, IOpenApiReadOnlyEx /// /// Maps a header name to its definition. /// - public Dictionary? Headers { get; } + public IDictionary? Headers { get; } /// /// A map containing descriptions of potential response payloads. /// The key is a media type or media type range and the value describes it. /// - public Dictionary? Content { get; } + public IDictionary? Content { get; } /// /// A map of operations links that can be followed from the response. /// The key of the map is a short name for the link, /// following the naming constraints of the names for Component Objects. /// - public Dictionary? Links { get; } + public IDictionary? Links { get; } } diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs index 51a94fc33..cc3ff51ec 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs @@ -35,7 +35,7 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// /// $vocabulary- used in meta-schemas to identify the vocabularies available for use in schemas described by that meta-schema. /// - public Dictionary? Vocabulary { get; } + public IDictionary? Vocabulary { get; } /// /// $dynamicRef - an applicator that allows for deferring the full resolution until runtime, at which point it is resolved each time it is encountered while evaluating an instance @@ -51,7 +51,7 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// $defs - reserves a location for schema authors to inline re-usable JSON Schemas into a more general schema. /// The keyword does not directly affect the validation result /// - public Dictionary? Definitions { get; } + public IDictionary? Definitions { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation @@ -144,19 +144,19 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. /// - public List? AllOf { get; } + public IList? AllOf { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. /// - public List? OneOf { get; } + public IList? OneOf { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. /// - public List? AnyOf { get; } + public IList? AnyOf { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation @@ -167,7 +167,7 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// - public HashSet? Required { get; } + public ISet? Required { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation @@ -195,7 +195,7 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced). /// - public Dictionary? Properties { get; } + public IDictionary? Properties { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation @@ -204,7 +204,7 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// egular expression dialect. Each property value of this object MUST be an object, and each object MUST /// be a valid Schema Object not a standard JSON Schema. /// - public Dictionary? PatternProperties { get; } + public IDictionary? PatternProperties { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation @@ -246,12 +246,12 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// To represent examples that cannot be naturally represented in JSON or YAML, /// a list of values can be used to contain the examples with escaping where necessary. /// - public List? Examples { get; } + public IList? Examples { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// - public List? Enum { get; } + public IList? Enum { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation @@ -278,10 +278,10 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// /// This object stores any unrecognized keywords found in the schema. /// - public Dictionary? UnrecognizedKeywords { get; } + public IDictionary? UnrecognizedKeywords { get; } /// /// Follow JSON Schema definition:https://json-schema.org/draft/2020-12/json-schema-validation#section-6.5.4 /// - public Dictionary>? DependentRequired { get; } + public IDictionary>? DependentRequired { get; } } diff --git a/src/Microsoft.OpenApi/Models/OpenApiCallback.cs b/src/Microsoft.OpenApi/Models/OpenApiCallback.cs index 90bb8ef62..7a67e3bdf 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiCallback.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiCallback.cs @@ -18,7 +18,7 @@ public class OpenApiCallback : IOpenApiExtensible, IOpenApiCallback /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs index 101fd7e51..a27cae914 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs @@ -15,57 +15,57 @@ public class OpenApiComponents : IOpenApiSerializable, IOpenApiExtensible /// /// An object to hold reusable Objects. /// - public Dictionary? Schemas { get; set; } + public IDictionary? Schemas { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Responses { get; set; } + public IDictionary? Responses { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Parameters { get; set; } + public IDictionary? Parameters { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Examples { get; set; } + public IDictionary? Examples { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? RequestBodies { get; set; } + public IDictionary? RequestBodies { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Headers { get; set; } + public IDictionary? Headers { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? SecuritySchemes { get; set; } + public IDictionary? SecuritySchemes { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Links { get; set; } + public IDictionary? Links { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Callbacks { get; set; } + public IDictionary? Callbacks { get; set; } /// /// An object to hold reusable Object. /// - public Dictionary? PathItems { get; set; } + public IDictionary? PathItems { get; set; } /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiContact.cs b/src/Microsoft.OpenApi/Models/OpenApiContact.cs index 40af53558..276566d56 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiContact.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiContact.cs @@ -30,7 +30,7 @@ public class OpenApiContact : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiDiscriminator.cs b/src/Microsoft.OpenApi/Models/OpenApiDiscriminator.cs index b5be98c88..96361d3d4 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiDiscriminator.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiDiscriminator.cs @@ -18,12 +18,12 @@ public class OpenApiDiscriminator : IOpenApiSerializable, IOpenApiExtensible /// /// An object to hold mappings between payload values and schema names or references. /// - public Dictionary? Mapping { get; set; } + public IDictionary? Mapping { get; set; } /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs index ddf9fde39..ff243b665 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs @@ -43,7 +43,7 @@ public void RegisterComponents() /// /// An array of Server Objects, which provide connectivity information to a target server. /// - public List? Servers { get; set; } = []; + public IList? Servers { get; set; } = []; /// /// REQUIRED. The available paths and operations for the API. @@ -55,7 +55,7 @@ public void RegisterComponents() /// A map of requests initiated other than by an API call, for example by an out of band registration. /// The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses /// - public Dictionary? Webhooks { get; set; } + public IDictionary? Webhooks { get; set; } /// /// An element to hold various schemas for the specification. @@ -65,13 +65,13 @@ public void RegisterComponents() /// /// A declaration of which security mechanisms can be used across the API. /// - public List? Security { get; set; } + public IList? Security { get; set; } - private HashSet? _tags; + private ISet? _tags; /// /// A list of tags used by the specification with additional metadata. /// - public HashSet? Tags + public ISet? Tags { get { @@ -97,10 +97,10 @@ public HashSet? Tags /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// - public Dictionary? Metadata { get; set; } + public IDictionary? Metadata { get; set; } /// /// Absolute location of the document or a generated placeholder if location is not given @@ -408,7 +408,7 @@ public void SerializeAsV2(IOpenApiWriter writer) return server.ReplaceServerUrlVariables([]); } - private static void WriteHostInfoV2(IOpenApiWriter writer, List? servers) + private static void WriteHostInfoV2(IOpenApiWriter writer, IList? servers) { if (servers == null || !servers.Any()) { @@ -660,7 +660,7 @@ public bool AddComponent(string id, T componentToRegister) Utils.CheckArgumentNullOrEmpty(id); Components ??= new(); - static bool AddToDictionary(Dictionary dict, string key, TValue value) + static bool AddToDictionary(IDictionary dict, string key, TValue value) { #if NET5_0_OR_GREATER return dict.TryAdd(key, value); @@ -678,43 +678,43 @@ static bool AddToDictionary(Dictionary dict, string key, switch (componentToRegister) { case IOpenApiSchema openApiSchema: - Components.Schemas ??= []; + Components.Schemas ??= new Dictionary(); added = AddToDictionary(Components.Schemas, id, openApiSchema); break; case IOpenApiParameter openApiParameter: - Components.Parameters ??= []; + Components.Parameters ??= new Dictionary(); added = AddToDictionary(Components.Parameters, id, openApiParameter); break; case IOpenApiResponse openApiResponse: - Components.Responses ??= []; + Components.Responses ??= new Dictionary(); added = AddToDictionary(Components.Responses, id, openApiResponse); break; case IOpenApiRequestBody openApiRequestBody: - Components.RequestBodies ??= []; + Components.RequestBodies ??= new Dictionary(); added = AddToDictionary(Components.RequestBodies, id, openApiRequestBody); break; case IOpenApiLink openApiLink: - Components.Links ??= []; + Components.Links ??= new Dictionary(); added = AddToDictionary(Components.Links, id, openApiLink); break; case IOpenApiCallback openApiCallback: - Components.Callbacks ??= []; + Components.Callbacks ??= new Dictionary(); added = AddToDictionary(Components.Callbacks, id, openApiCallback); break; case IOpenApiPathItem openApiPathItem: - Components.PathItems ??= []; + Components.PathItems ??= new Dictionary(); added = AddToDictionary(Components.PathItems, id, openApiPathItem); break; case IOpenApiExample openApiExample: - Components.Examples ??= []; + Components.Examples ??= new Dictionary(); added = AddToDictionary(Components.Examples, id, openApiExample); break; case IOpenApiHeader openApiHeader: - Components.Headers ??= []; + Components.Headers ??= new Dictionary(); added = AddToDictionary(Components.Headers, id, openApiHeader); break; case IOpenApiSecurityScheme openApiSecurityScheme: - Components.SecuritySchemes ??= []; + Components.SecuritySchemes ??= new Dictionary(); added = AddToDictionary(Components.SecuritySchemes, id, openApiSecurityScheme); break; default: diff --git a/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs b/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs index c7bccbfcb..b478b8074 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs @@ -21,7 +21,7 @@ public class OpenApiEncoding : IOpenApiSerializable, IOpenApiExtensible /// /// A map allowing additional information to be provided as headers. /// - public Dictionary? Headers { get; set; } + public IDictionary? Headers { get; set; } /// /// Describes how a specific property value will be serialized depending on its type. @@ -48,7 +48,7 @@ public class OpenApiEncoding : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiExample.cs b/src/Microsoft.OpenApi/Models/OpenApiExample.cs index 42b839867..0ebea9da9 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiExample.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiExample.cs @@ -24,7 +24,7 @@ public class OpenApiExample : IOpenApiExtensible, IOpenApiExample public JsonNode? Value { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiExtensibleDictionary.cs b/src/Microsoft.OpenApi/Models/OpenApiExtensibleDictionary.cs index 508885efe..bf49f9099 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiExtensibleDictionary.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiExtensibleDictionary.cs @@ -34,7 +34,7 @@ protected OpenApiExtensibleDictionary( /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// diff --git a/src/Microsoft.OpenApi/Models/OpenApiExternalDocs.cs b/src/Microsoft.OpenApi/Models/OpenApiExternalDocs.cs index 43da4bb20..8c16397c0 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiExternalDocs.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiExternalDocs.cs @@ -24,7 +24,7 @@ public class OpenApiExternalDocs : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiHeader.cs b/src/Microsoft.OpenApi/Models/OpenApiHeader.cs index fe34c46fd..8bb155f85 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiHeader.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiHeader.cs @@ -41,13 +41,13 @@ public class OpenApiHeader : IOpenApiHeader, IOpenApiExtensible public JsonNode? Example { get; set; } /// - public Dictionary? Examples { get; set; } + public IDictionary? Examples { get; set; } /// - public Dictionary? Content { get; set; } + public IDictionary? Content { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiInfo.cs b/src/Microsoft.OpenApi/Models/OpenApiInfo.cs index 1925f3b4b..8b004bf74 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiInfo.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiInfo.cs @@ -49,7 +49,7 @@ public class OpenApiInfo : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiLicense.cs b/src/Microsoft.OpenApi/Models/OpenApiLicense.cs index 542d02d02..04a267bdc 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiLicense.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiLicense.cs @@ -29,7 +29,7 @@ public class OpenApiLicense : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiLink.cs b/src/Microsoft.OpenApi/Models/OpenApiLink.cs index 7f7d06773..1571dcadd 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiLink.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiLink.cs @@ -18,7 +18,7 @@ public class OpenApiLink : IOpenApiExtensible, IOpenApiLink public string? OperationId { get; set; } /// - public Dictionary? Parameters { get; set; } + public IDictionary? Parameters { get; set; } /// public RuntimeExpressionAnyWrapper? RequestBody { get; set; } @@ -30,7 +30,7 @@ public class OpenApiLink : IOpenApiExtensible, IOpenApiLink public OpenApiServer? Server { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs b/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs index 3e11e0810..7520678e1 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs @@ -28,7 +28,7 @@ public class OpenApiMediaType : IOpenApiSerializable, IOpenApiExtensible /// Examples of the media type. /// Each example object SHOULD match the media type and specified schema if present. /// - public Dictionary? Examples { get; set; } + public IDictionary? Examples { get; set; } /// /// A map between a property name and its encoding information. @@ -36,12 +36,12 @@ public class OpenApiMediaType : IOpenApiSerializable, IOpenApiExtensible /// The encoding object SHALL only apply to requestBody objects /// when the media type is multipart or application/x-www-form-urlencoded. /// - public Dictionary? Encoding { get; set; } + public IDictionary? Encoding { get; set; } /// /// Serialize to Open Api v3.0. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor @@ -115,7 +115,7 @@ public virtual void SerializeAsV2(IOpenApiWriter writer) // Media type does not exist in V2. } - private static void SerializeExamples(IOpenApiWriter writer, Dictionary examples, Action callback) + private static void SerializeExamples(IOpenApiWriter writer, IDictionary examples, Action callback) { /* Special case for writing out empty arrays as valid response examples * Check if there is any example with an empty array as its value and set the flag `hasEmptyArray` to true diff --git a/src/Microsoft.OpenApi/Models/OpenApiOAuthFlow.cs b/src/Microsoft.OpenApi/Models/OpenApiOAuthFlow.cs index fa0a60684..5bfeba500 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiOAuthFlow.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiOAuthFlow.cs @@ -31,12 +31,12 @@ public class OpenApiOAuthFlow : IOpenApiSerializable, IOpenApiExtensible /// /// REQUIRED. A map between the scope name and a short description for it. /// - public Dictionary? Scopes { get; set; } + public IDictionary? Scopes { get; set; } /// /// Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiOAuthFlows.cs b/src/Microsoft.OpenApi/Models/OpenApiOAuthFlows.cs index a12dc1000..16a6f17b3 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiOAuthFlows.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiOAuthFlows.cs @@ -34,7 +34,7 @@ public class OpenApiOAuthFlows : IOpenApiSerializable, IOpenApiExtensible /// /// Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs index 21e4f5ea2..d354907ee 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs @@ -17,12 +17,12 @@ public class OpenApiOperation : IOpenApiSerializable, IOpenApiExtensible, IMetad /// public const bool DeprecatedDefault = false; - private HashSet? _tags; + private ISet? _tags; /// /// A list of tags for API documentation control. /// Tags can be used for logical grouping of operations by resources or any other qualifier. /// - public HashSet? Tags + public ISet? Tags { get { @@ -69,7 +69,7 @@ public HashSet? Tags /// The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. /// The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object's components/parameters. /// - public List? Parameters { get; set; } + public IList? Parameters { get; set; } /// /// The request body applicable for this operation. @@ -92,7 +92,7 @@ public HashSet? Tags /// The key value used to identify the callback object is an expression, evaluated at runtime, /// that identifies a URL to use for the callback operation. /// - public Dictionary? Callbacks { get; set; } + public IDictionary? Callbacks { get; set; } /// /// Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. @@ -106,22 +106,22 @@ public HashSet? Tags /// This definition overrides any declared top-level security. /// To remove a top-level security declaration, an empty array can be used. /// - public List? Security { get; set; } + public IList? Security { get; set; } /// /// An alternative server array to service this operation. /// If an alternative server object is specified at the Path Item Object or Root level, /// it will be overridden by this value. /// - public List? Servers { get; set; } + public IList? Servers { get; set; } /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// - public Dictionary? Metadata { get; set; } + public IDictionary? Metadata { get; set; } /// /// Parameterless constructor @@ -134,7 +134,7 @@ public OpenApiOperation() { } public OpenApiOperation(OpenApiOperation operation) { Utils.CheckArgumentNull(operation); - Tags = operation.Tags != null ? [.. operation.Tags] : null; + Tags = operation.Tags != null ? new HashSet(operation.Tags) : null; Summary = operation.Summary ?? Summary; Description = operation.Description ?? Description; ExternalDocs = operation.ExternalDocs != null ? new(operation.ExternalDocs) : null; diff --git a/src/Microsoft.OpenApi/Models/OpenApiParameter.cs b/src/Microsoft.OpenApi/Models/OpenApiParameter.cs index 77c6e1f4e..63b3735e2 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiParameter.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiParameter.cs @@ -55,16 +55,16 @@ public bool Explode public IOpenApiSchema? Schema { get; set; } /// - public Dictionary? Examples { get; set; } + public IDictionary? Examples { get; set; } /// public JsonNode? Example { get; set; } /// - public Dictionary? Content { get; set; } + public IDictionary? Content { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// A parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs b/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs index bc8a17d22..0be48961d 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs @@ -22,13 +22,13 @@ public class OpenApiPathItem : IOpenApiExtensible, IOpenApiPathItem public Dictionary? Operations { get; set; } /// - public List? Servers { get; set; } + public IList? Servers { get; set; } /// - public List? Parameters { get; set; } + public IList? Parameters { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Add one operation into this path item. diff --git a/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs b/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs index cc55bb7e6..8f4c1bd90 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs @@ -19,10 +19,10 @@ public class OpenApiRequestBody : IOpenApiExtensible, IOpenApiRequestBody public bool Required { get; set; } /// - public Dictionary? Content { get; set; } + public IDictionary? Content { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiResponse.cs b/src/Microsoft.OpenApi/Models/OpenApiResponse.cs index d9446b2ed..6c1af10f1 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiResponse.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiResponse.cs @@ -16,16 +16,16 @@ public class OpenApiResponse : IOpenApiExtensible, IOpenApiResponse public string? Description { get; set; } /// - public Dictionary? Headers { get; set; } + public IDictionary? Headers { get; set; } /// - public Dictionary? Content { get; set; } + public IDictionary? Content { get; set; } /// - public Dictionary? Links { get; set; } + public IDictionary? Links { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs index 6044acad5..17ba10ada 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs @@ -27,7 +27,7 @@ public class OpenApiSchema : IOpenApiExtensible, IOpenApiSchema, IMetadataContai public string? Comment { get; set; } /// - public Dictionary? Vocabulary { get; set; } + public IDictionary? Vocabulary { get; set; } /// public string? DynamicRef { get; set; } @@ -36,7 +36,7 @@ public class OpenApiSchema : IOpenApiExtensible, IOpenApiSchema, IMetadataContai public string? DynamicAnchor { get; set; } /// - public Dictionary? Definitions { get; set; } + public IDictionary? Definitions { get; set; } private string? _exclusiveMaximum; /// @@ -175,19 +175,19 @@ public string? Minimum public bool WriteOnly { get; set; } /// - public List? AllOf { get; set; } + public IList? AllOf { get; set; } /// - public List? OneOf { get; set; } + public IList? OneOf { get; set; } /// - public List? AnyOf { get; set; } + public IList? AnyOf { get; set; } /// public IOpenApiSchema? Not { get; set; } /// - public HashSet? Required { get; set; } + public ISet? Required { get; set; } /// public IOpenApiSchema? Items { get; set; } @@ -202,10 +202,10 @@ public string? Minimum public bool? UniqueItems { get; set; } /// - public Dictionary? Properties { get; set; } + public IDictionary? Properties { get; set; } /// - public Dictionary? PatternProperties { get; set; } + public IDictionary? PatternProperties { get; set; } /// public int? MaxProperties { get; set; } @@ -226,10 +226,10 @@ public string? Minimum public JsonNode? Example { get; set; } /// - public List? Examples { get; set; } + public IList? Examples { get; set; } /// - public List? Enum { get; set; } + public IList? Enum { get; set; } /// public bool UnevaluatedProperties { get; set; } @@ -244,16 +244,16 @@ public string? Minimum public OpenApiXml? Xml { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// - public Dictionary? UnrecognizedKeywords { get; set; } + public IDictionary? UnrecognizedKeywords { get; set; } /// - public Dictionary? Metadata { get; set; } + public IDictionary? Metadata { get; set; } /// - public Dictionary>? DependentRequired { get; set; } + public IDictionary>? DependentRequired { get; set; } /// /// Parameterless constructor @@ -300,7 +300,7 @@ internal OpenApiSchema(IOpenApiSchema schema) OneOf = schema.OneOf != null ? [.. schema.OneOf] : null; AnyOf = schema.AnyOf != null ? [.. schema.AnyOf] : null; Not = schema.Not?.CreateShallowCopy(); - Required = schema.Required != null ? [.. schema.Required] : null; + Required = schema.Required != null ? new HashSet(schema.Required) : null; Items = schema.Items?.CreateShallowCopy(); MaxItems = schema.MaxItems ?? MaxItems; MinItems = schema.MinItems ?? MinItems; @@ -620,7 +620,7 @@ private void WriteFormatProperty(IOpenApiWriter writer) /// The property name that will be serialized. private void SerializeAsV2( IOpenApiWriter writer, - HashSet? parentRequiredProperties, + ISet? parentRequiredProperties, string? propertyName) { parentRequiredProperties ??= new HashSet(); diff --git a/src/Microsoft.OpenApi/Models/OpenApiSecurityScheme.cs b/src/Microsoft.OpenApi/Models/OpenApiSecurityScheme.cs index 5cc0e6a5c..7d82f3219 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiSecurityScheme.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiSecurityScheme.cs @@ -36,7 +36,7 @@ public class OpenApiSecurityScheme : IOpenApiExtensible, IOpenApiSecurityScheme public Uri? OpenIdConnectUrl { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiServer.cs b/src/Microsoft.OpenApi/Models/OpenApiServer.cs index b9cd14d48..6a05057c1 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiServer.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiServer.cs @@ -26,12 +26,12 @@ public class OpenApiServer : IOpenApiSerializable, IOpenApiExtensible /// /// A map between a variable name and its value. The value is used for substitution in the server's URL template. /// - public Dictionary? Variables { get; set; } + public IDictionary? Variables { get; set; } /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiServerVariable.cs b/src/Microsoft.OpenApi/Models/OpenApiServerVariable.cs index 816658133..8f743b756 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiServerVariable.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiServerVariable.cs @@ -32,7 +32,7 @@ public class OpenApiServerVariable : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiTag.cs b/src/Microsoft.OpenApi/Models/OpenApiTag.cs index 4619cecca..91dabb976 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiTag.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiTag.cs @@ -21,7 +21,7 @@ public class OpenApiTag : IOpenApiExtensible, IOpenApiTag, IOpenApiDescribedElem public OpenApiExternalDocs? ExternalDocs { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiXml.cs b/src/Microsoft.OpenApi/Models/OpenApiXml.cs index a1a1f0154..76f4e0d13 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiXml.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiXml.cs @@ -41,7 +41,7 @@ public class OpenApiXml : IOpenApiSerializable, IOpenApiExtensible /// /// Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiCallbackReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiCallbackReference.cs index e4531c678..ebba35087 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiCallbackReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiCallbackReference.cs @@ -36,7 +36,7 @@ private OpenApiCallbackReference(OpenApiCallbackReference callback):base(callbac public Dictionary? PathItems { get => Target?.PathItems; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiCallback CopyReferenceAsTargetElementWithOverrides(IOpenApiCallback source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiExampleReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiExampleReference.cs index 38b4069b6..b699786f4 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiExampleReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiExampleReference.cs @@ -47,7 +47,7 @@ public string? Summary } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public string? ExternalValue { get => Target?.ExternalValue; } diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiHeaderReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiHeaderReference.cs index 9fbba7745..f610b0c02 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiHeaderReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiHeaderReference.cs @@ -65,13 +65,13 @@ public string? Description public JsonNode? Example { get => Target?.Example; } /// - public Dictionary? Examples { get => Target?.Examples; } + public IDictionary? Examples { get => Target?.Examples; } /// - public Dictionary? Content { get => Target?.Content; } + public IDictionary? Content { get => Target?.Content; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiHeader CopyReferenceAsTargetElementWithOverrides(IOpenApiHeader source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiLinkReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiLinkReference.cs index da654e716..05405c680 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiLinkReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiLinkReference.cs @@ -48,13 +48,13 @@ public string? Description public OpenApiServer? Server { get => Target?.Server; } /// - public Dictionary? Parameters { get => Target?.Parameters; } + public IDictionary? Parameters { get => Target?.Parameters; } /// public RuntimeExpressionAnyWrapper? RequestBody { get => Target?.RequestBody; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override void SerializeAsV2(IOpenApiWriter writer) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiParameterReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiParameterReference.cs index 9e144259d..9912e651b 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiParameterReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiParameterReference.cs @@ -59,7 +59,7 @@ public string? Description public IOpenApiSchema? Schema { get => Target?.Schema; } /// - public Dictionary? Examples { get => Target?.Examples; } + public IDictionary? Examples { get => Target?.Examples; } /// public JsonNode? Example { get => Target?.Example; } @@ -74,10 +74,10 @@ public string? Description public bool Explode { get => Target?.Explode ?? default; } /// - public Dictionary? Content { get => Target?.Content; } + public IDictionary? Content { get => Target?.Content; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiParameter CopyReferenceAsTargetElementWithOverrides(IOpenApiParameter source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs index 4971e0e17..b440e81a2 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs @@ -53,13 +53,13 @@ public string? Description public Dictionary? Operations { get => Target?.Operations; } /// - public List? Servers { get => Target?.Servers; } + public IList? Servers { get => Target?.Servers; } /// - public List? Parameters { get => Target?.Parameters; } + public IList? Parameters { get => Target?.Parameters; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiPathItem CopyReferenceAsTargetElementWithOverrides(IOpenApiPathItem source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiRequestBodyReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiRequestBodyReference.cs index a9081e957..dffa8f342 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiRequestBodyReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiRequestBodyReference.cs @@ -41,13 +41,13 @@ public string? Description } /// - public Dictionary? Content { get => Target?.Content; } + public IDictionary? Content { get => Target?.Content; } /// public bool Required { get => Target?.Required ?? false; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiRequestBody CopyReferenceAsTargetElementWithOverrides(IOpenApiRequestBody source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiResponseReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiResponseReference.cs index e8c632301..78ec42be4 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiResponseReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiResponseReference.cs @@ -40,16 +40,16 @@ public string? Description } /// - public Dictionary? Content { get => Target?.Content; } + public IDictionary? Content { get => Target?.Content; } /// - public Dictionary? Headers { get => Target?.Headers; } + public IDictionary? Headers { get => Target?.Headers; } /// - public Dictionary? Links { get => Target?.Links; } + public IDictionary? Links { get => Target?.Links; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiResponse CopyReferenceAsTargetElementWithOverrides(IOpenApiResponse source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs index b9e28eeb1..f28d3f683 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs @@ -49,13 +49,13 @@ public string? Description /// public string? Comment { get => Target?.Comment; } /// - public Dictionary? Vocabulary { get => Target?.Vocabulary; } + public IDictionary? Vocabulary { get => Target?.Vocabulary; } /// public string? DynamicRef { get => Target?.DynamicRef; } /// public string? DynamicAnchor { get => Target?.DynamicAnchor; } /// - public Dictionary? Definitions { get => Target?.Definitions; } + public IDictionary? Definitions { get => Target?.Definitions; } /// public string? ExclusiveMaximum { get => Target?.ExclusiveMaximum; } /// @@ -85,15 +85,15 @@ public string? Description /// public bool WriteOnly { get => Target?.WriteOnly ?? false; } /// - public List? AllOf { get => Target?.AllOf; } + public IList? AllOf { get => Target?.AllOf; } /// - public List? OneOf { get => Target?.OneOf; } + public IList? OneOf { get => Target?.OneOf; } /// - public List? AnyOf { get => Target?.AnyOf; } + public IList? AnyOf { get => Target?.AnyOf; } /// public IOpenApiSchema? Not { get => Target?.Not; } /// - public HashSet? Required { get => Target?.Required; } + public ISet? Required { get => Target?.Required; } /// public IOpenApiSchema? Items { get => Target?.Items; } /// @@ -103,9 +103,9 @@ public string? Description /// public bool? UniqueItems { get => Target?.UniqueItems; } /// - public Dictionary? Properties { get => Target?.Properties; } + public IDictionary? Properties { get => Target?.Properties; } /// - public Dictionary? PatternProperties { get => Target?.PatternProperties; } + public IDictionary? PatternProperties { get => Target?.PatternProperties; } /// public int? MaxProperties { get => Target?.MaxProperties; } /// @@ -119,9 +119,9 @@ public string? Description /// public JsonNode? Example { get => Target?.Example; } /// - public List? Examples { get => Target?.Examples; } + public IList? Examples { get => Target?.Examples; } /// - public List? Enum { get => Target?.Enum; } + public IList? Enum { get => Target?.Enum; } /// public bool UnevaluatedProperties { get => Target?.UnevaluatedProperties ?? false; } /// @@ -131,13 +131,13 @@ public string? Description /// public OpenApiXml? Xml { get => Target?.Xml; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// - public Dictionary? UnrecognizedKeywords { get => Target?.UnrecognizedKeywords; } + public IDictionary? UnrecognizedKeywords { get => Target?.UnrecognizedKeywords; } /// - public Dictionary>? DependentRequired { get => Target?.DependentRequired; } + public IDictionary>? DependentRequired { get => Target?.DependentRequired; } /// public override void SerializeAsV31(IOpenApiWriter writer) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiSecuritySchemeReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiSecuritySchemeReference.cs index dac7d492c..52b4f9291 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiSecuritySchemeReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiSecuritySchemeReference.cs @@ -55,7 +55,7 @@ public string? Description public Uri? OpenIdConnectUrl { get => Target?.OpenIdConnectUrl; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public SecuritySchemeType? Type { get => Target?.Type; } diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiTagReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiTagReference.cs index 6fb1f9501..b32e0eff6 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiTagReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiTagReference.cs @@ -54,7 +54,7 @@ public string? Description public OpenApiExternalDocs? ExternalDocs { get => Target?.ExternalDocs; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public string? Name { get => Target?.Name ?? Reference?.Id; } diff --git a/src/Microsoft.OpenApi/Reader/OpenApiDiagnostic.cs b/src/Microsoft.OpenApi/Reader/OpenApiDiagnostic.cs index bc5fd72a4..664dc942b 100644 --- a/src/Microsoft.OpenApi/Reader/OpenApiDiagnostic.cs +++ b/src/Microsoft.OpenApi/Reader/OpenApiDiagnostic.cs @@ -13,12 +13,12 @@ public class OpenApiDiagnostic : IDiagnostic /// /// List of all errors. /// - public List Errors { get; set; } = []; + public IList Errors { get; set; } = []; /// /// List of all warnings /// - public List Warnings { get; set; } = []; + public IList Warnings { get; set; } = []; /// /// Open API specification version of the document parsed. diff --git a/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs index 7a8dca287..4dfc36a5b 100644 --- a/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs +++ b/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs @@ -13,7 +13,7 @@ internal class AnyMapFieldMapParameter /// Constructor /// public AnyMapFieldMapParameter( - Func?> propertyMapGetter, + Func?> propertyMapGetter, Func propertyGetter, Action propertySetter, Func schemaGetter) @@ -27,7 +27,7 @@ public AnyMapFieldMapParameter( /// /// Function to retrieve the property that is a map from string to an inner element. /// - public Func?> PropertyMapGetter { get; } + public Func?> PropertyMapGetter { get; } /// /// Function to retrieve the value of the property from an inner element. diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs index 98c0aa6fc..fc981bf7e 100644 --- a/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs @@ -111,7 +111,7 @@ internal static partial class OpenApiV2Deserializer {s => s.StartsWith(OpenApiConstants.ExtensionFieldNamePrefix, StringComparison.OrdinalIgnoreCase), (o, p, n, _) => o.AddExtension(p, LoadExtension(p, n))} }; - private static void MakeServers(List servers, ParsingContext context, RootNode rootNode) + private static void MakeServers(IList servers, ParsingContext context, RootNode rootNode) { var host = context.GetFromTempStorage("host"); var basePath = context.GetFromTempStorage("basePath"); @@ -307,8 +307,8 @@ private static bool IsHostValid(string host) internal class RequestBodyReferenceFixer : OpenApiVisitorBase { - private readonly Dictionary _requestBodies; - public RequestBodyReferenceFixer(Dictionary requestBodies) + private readonly IDictionary _requestBodies; + public RequestBodyReferenceFixer(IDictionary requestBodies) { _requestBodies = requestBodies; } diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs index b232c11d9..4adf036ba 100644 --- a/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs @@ -238,7 +238,7 @@ internal static IOpenApiRequestBody CreateRequestBody( if (bodyParameter.Name is not null) { - requestBody.Extensions ??= []; + requestBody.Extensions ??= new Dictionary(); requestBody.Extensions[OpenApiConstants.BodyName] = new JsonNodeExtension(bodyParameter.Name); } return requestBody; diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiResponseDeserializer.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiResponseDeserializer.cs index 8d399b8c1..07a1d7949 100644 --- a/src/Microsoft.OpenApi/Reader/V2/OpenApiResponseDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiResponseDeserializer.cs @@ -57,7 +57,7 @@ private static void ProcessProduces(MapNode mapNode, OpenApiResponse response, P { if (response.Content == null) { - response.Content = []; + response.Content = new Dictionary(); } else if (context.GetFromTempStorage(TempStorageKeys.ResponseProducesSet, response)) { diff --git a/src/Microsoft.OpenApi/Services/CopyReferences.cs b/src/Microsoft.OpenApi/Services/CopyReferences.cs index c1e77c780..ab740e509 100644 --- a/src/Microsoft.OpenApi/Services/CopyReferences.cs +++ b/src/Microsoft.OpenApi/Services/CopyReferences.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; + namespace Microsoft.OpenApi; internal class CopyReferences(OpenApiDocument target) : OpenApiVisitorBase { @@ -85,7 +87,7 @@ private void AddSchemaToComponents(IOpenApiSchema? schema, string? referenceId = EnsureSchemasExist(); if (referenceId is not null && schema is not null && !(Components.Schemas?.ContainsKey(referenceId) ?? false)) { - Components.Schemas ??= []; + Components.Schemas ??= new Dictionary(); Components.Schemas.Add(referenceId, schema); } } @@ -96,7 +98,7 @@ private void AddParameterToComponents(IOpenApiParameter? parameter, string? refe EnsureParametersExist(); if (parameter is not null && referenceId is not null && !(Components.Parameters?.ContainsKey(referenceId) ?? false)) { - Components.Parameters ??= []; + Components.Parameters ??= new Dictionary(); Components.Parameters.Add(referenceId, parameter); } } @@ -107,7 +109,7 @@ private void AddResponseToComponents(IOpenApiResponse? response, string? referen EnsureResponsesExist(); if (referenceId is not null && response is not null && !(Components.Responses?.ContainsKey(referenceId) ?? false)) { - Components.Responses ??= []; + Components.Responses ??= new Dictionary(); Components.Responses.Add(referenceId, response); } } @@ -117,7 +119,7 @@ private void AddRequestBodyToComponents(IOpenApiRequestBody? requestBody, string EnsureRequestBodiesExist(); if (requestBody is not null && referenceId is not null && !(Components.RequestBodies?.ContainsKey(referenceId) ?? false)) { - Components.RequestBodies ??= []; + Components.RequestBodies ??= new Dictionary(); Components.RequestBodies.Add(referenceId, requestBody); } } @@ -127,7 +129,7 @@ private void AddLinkToComponents(IOpenApiLink? link, string? referenceId = null) EnsureLinksExist(); if (link is not null && referenceId is not null && !(Components.Links?.ContainsKey(referenceId) ?? false)) { - Components.Links ??= []; + Components.Links ??= new Dictionary(); Components.Links.Add(referenceId, link); } } @@ -137,7 +139,7 @@ private void AddCallbackToComponents(IOpenApiCallback? callback, string? referen EnsureCallbacksExist(); if (callback is not null && referenceId is not null && !(Components.Callbacks?.ContainsKey(referenceId) ?? false)) { - Components.Callbacks ??= []; + Components.Callbacks ??= new Dictionary(); Components.Callbacks.Add(referenceId, callback); } } @@ -147,7 +149,7 @@ private void AddHeaderToComponents(IOpenApiHeader? header, string? referenceId = EnsureHeadersExist(); if (header is not null && referenceId is not null && !(Components.Headers?.ContainsKey(referenceId) ?? false)) { - Components.Headers ??= []; + Components.Headers ??= new Dictionary(); Components.Headers.Add(referenceId, header); } } @@ -157,7 +159,7 @@ private void AddExampleToComponents(IOpenApiExample? example, string? referenceI EnsureExamplesExist(); if (example is not null && referenceId is not null && !(Components.Examples?.ContainsKey(referenceId) ?? false)) { - Components.Examples ??= []; + Components.Examples ??= new Dictionary(); Components.Examples.Add(referenceId, example); } } @@ -167,7 +169,7 @@ private void AddPathItemToComponents(IOpenApiPathItem? pathItem, string? referen EnsurePathItemsExist(); if (pathItem is not null && referenceId is not null && !(Components.PathItems?.ContainsKey(referenceId) ?? false)) { - Components.PathItems ??= []; + Components.PathItems ??= new Dictionary(); Components.PathItems.Add(referenceId, pathItem); } } @@ -177,7 +179,7 @@ private void AddSecuritySchemeToComponents(IOpenApiSecurityScheme? securitySchem EnsureSecuritySchemesExist(); if (securityScheme is not null && referenceId is not null && !(Components.SecuritySchemes?.ContainsKey(referenceId) ?? false)) { - Components.SecuritySchemes ??= []; + Components.SecuritySchemes ??= new Dictionary(); Components.SecuritySchemes.Add(referenceId, securityScheme); } } @@ -202,7 +204,7 @@ private void EnsureSchemasExist() { if (_target.Components is not null) { - _target.Components.Schemas ??= []; + _target.Components.Schemas ??= new Dictionary(); } } @@ -210,7 +212,7 @@ private void EnsureParametersExist() { if (_target.Components is not null) { - _target.Components.Parameters ??= []; + _target.Components.Parameters ??= new Dictionary(); } } @@ -218,7 +220,7 @@ private void EnsureResponsesExist() { if (_target.Components is not null) { - _target.Components.Responses ??= []; + _target.Components.Responses ??= new Dictionary(); } } @@ -226,7 +228,7 @@ private void EnsureRequestBodiesExist() { if (_target.Components is not null) { - _target.Components.RequestBodies ??= []; + _target.Components.RequestBodies ??= new Dictionary(); } } @@ -234,7 +236,7 @@ private void EnsureExamplesExist() { if (_target.Components is not null) { - _target.Components.Examples ??= []; + _target.Components.Examples ??= new Dictionary(); } } @@ -242,7 +244,7 @@ private void EnsureHeadersExist() { if (_target.Components is not null) { - _target.Components.Headers ??= []; + _target.Components.Headers ??= new Dictionary(); } } @@ -250,7 +252,7 @@ private void EnsureCallbacksExist() { if (_target.Components is not null) { - _target.Components.Callbacks ??= []; + _target.Components.Callbacks ??= new Dictionary(); } } @@ -258,7 +260,7 @@ private void EnsureLinksExist() { if (_target.Components is not null) { - _target.Components.Links ??= []; + _target.Components.Links ??= new Dictionary(); } } @@ -266,14 +268,14 @@ private void EnsureSecuritySchemesExist() { if (_target.Components is not null) { - _target.Components.SecuritySchemes ??= []; + _target.Components.SecuritySchemes ??= new Dictionary(); } } private void EnsurePathItemsExist() { if (_target.Components is not null) { - _target.Components.PathItems = []; + _target.Components.PathItems = new Dictionary(); } } } diff --git a/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs b/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs index 295ba6c37..101e259ce 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs @@ -227,7 +227,7 @@ public static OpenApiUrlTreeNode CreateOpenApiUrlTreeNode(Dictionary FindOperations(OpenApiDocument sourceDocument, Func predicate) + private static IList FindOperations(OpenApiDocument sourceDocument, Func predicate) { var search = new OperationSearch(predicate); var walker = new OpenApiWalker(search); @@ -351,7 +351,7 @@ private static bool AddReferences(OpenApiComponents newComponents, OpenApiCompon return moreStuff; } - private static string ExtractPath(string url, List? serverList) + private static string ExtractPath(string url, IList? serverList) { // if OpenAPI has servers, then see if the url matches one of them var baseUrl = serverList?.Select(s => s.Url?.TrimEnd('/')) diff --git a/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs b/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs index 3097b853b..fd031d8aa 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs @@ -19,7 +19,7 @@ public class OpenApiUrlTreeNode /// /// All the subdirectories of a node. /// - public Dictionary Children { get; } = new Dictionary(); + public IDictionary Children { get; } = new Dictionary(); /// /// The relative directory path of the current node from the root node. @@ -29,12 +29,12 @@ public class OpenApiUrlTreeNode /// /// Dictionary of labels and Path Item objects that describe the operations available on a node. /// - public Dictionary PathItems { get; } = new Dictionary(); + public IDictionary PathItems { get; } = new Dictionary(); /// /// A dictionary of key value pairs that contain information about a node. /// - public Dictionary> AdditionalData { get; set; } = new Dictionary>(); + public IDictionary> AdditionalData { get; set; } = new Dictionary>(); /// /// Flag indicating whether a node segment is a path parameter. diff --git a/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs b/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs index 6133d461c..1ccfea863 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs @@ -82,7 +82,7 @@ public virtual void Visit(OpenApiLicense license) /// /// Visits list of /// - public virtual void Visit(List servers) + public virtual void Visit(IList servers) { } @@ -103,7 +103,7 @@ public virtual void Visit(OpenApiPaths paths) /// /// Visits Webhooks> /// - public virtual void Visit(Dictionary webhooks) + public virtual void Visit(IDictionary webhooks) { } @@ -124,7 +124,7 @@ public virtual void Visit(OpenApiServerVariable serverVariable) /// /// Visits the operations. /// - public virtual void Visit(Dictionary operations) + public virtual void Visit(IDictionary operations) { } @@ -138,7 +138,7 @@ public virtual void Visit(OpenApiOperation operation) /// /// Visits list of /// - public virtual void Visit(List parameters) + public virtual void Visit(IList parameters) { } @@ -159,14 +159,14 @@ public virtual void Visit(IOpenApiRequestBody requestBody) /// /// Visits headers. /// - public virtual void Visit(Dictionary headers) + public virtual void Visit(IDictionary headers) { } /// /// Visits callbacks. /// - public virtual void Visit(Dictionary callbacks) + public virtual void Visit(IDictionary callbacks) { } @@ -187,7 +187,7 @@ public virtual void Visit(OpenApiResponses response) /// /// Visits media type content. /// - public virtual void Visit(Dictionary content) + public virtual void Visit(IDictionary content) { } @@ -208,7 +208,7 @@ public virtual void Visit(OpenApiEncoding encoding) /// /// Visits the examples. /// - public virtual void Visit(Dictionary examples) + public virtual void Visit(IDictionary examples) { } @@ -236,7 +236,7 @@ public virtual void Visit(IOpenApiSchema schema) /// /// Visits the links. /// - public virtual void Visit(Dictionary links) + public virtual void Visit(IDictionary links) { } @@ -306,21 +306,21 @@ public virtual void Visit(IOpenApiExample example) /// /// Visits list of /// - public virtual void Visit(HashSet openApiTags) + public virtual void Visit(ISet openApiTags) { } /// /// Visits list of /// - public virtual void Visit(HashSet openApiTags) + public virtual void Visit(ISet openApiTags) { } /// /// Visits list of /// - public virtual void Visit(List openApiSecurityRequirements) + public virtual void Visit(IList openApiSecurityRequirements) { } @@ -348,7 +348,7 @@ public virtual void Visit(List example) /// /// Visits a dictionary of server variables /// - public virtual void Visit(Dictionary serverVariables) + public virtual void Visit(IDictionary serverVariables) { } @@ -356,7 +356,7 @@ public virtual void Visit(Dictionary serverVariab /// Visits a dictionary of encodings /// /// - public virtual void Visit(Dictionary encodings) + public virtual void Visit(IDictionary encodings) { } diff --git a/src/Microsoft.OpenApi/Services/OpenApiWalker.cs b/src/Microsoft.OpenApi/Services/OpenApiWalker.cs index e9d13a704..e3a5fbead 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiWalker.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiWalker.cs @@ -56,7 +56,7 @@ public void Walk(OpenApiDocument? doc) /// /// Visits list of and child objects /// - internal void Walk(HashSet? tags) + internal void Walk(ISet? tags) { if (tags == null) { @@ -79,7 +79,7 @@ internal void Walk(HashSet? tags) /// /// Visits list of and child objects /// - internal void Walk(HashSet? tags) + internal void Walk(ISet? tags) { if (tags == null) { @@ -277,7 +277,7 @@ internal void Walk(OpenApiPaths paths) /// /// Visits Webhooks and child objects /// - internal void Walk(Dictionary? webhooks) + internal void Walk(IDictionary? webhooks) { if (webhooks == null) { @@ -301,7 +301,7 @@ internal void Walk(Dictionary? webhooks) /// /// Visits list of and child objects /// - internal void Walk(List? servers) + internal void Walk(IList? servers) { if (servers == null) { @@ -483,7 +483,7 @@ internal void Walk(OpenApiServer? server) /// /// Visits dictionary of /// - internal void Walk(Dictionary? serverVariables) + internal void Walk(IDictionary? serverVariables) { if (serverVariables == null) { @@ -560,7 +560,7 @@ internal void Walk(IOpenApiPathItem pathItem, bool isComponent = false) /// /// Visits dictionary of /// - internal void Walk(Dictionary? operations) + internal void Walk(IDictionary? operations) { if (operations == null) { @@ -604,7 +604,7 @@ internal void Walk(OpenApiOperation operation) /// /// Visits list of /// - internal void Walk(List? securityRequirements) + internal void Walk(IList? securityRequirements) { if (securityRequirements == null) { @@ -625,7 +625,7 @@ internal void Walk(List? securityRequirements) /// /// Visits list of /// - internal void Walk(List? parameters) + internal void Walk(IList? parameters) { if (parameters == null) { @@ -742,7 +742,7 @@ internal void Walk(IOpenApiRequestBody? requestBody, bool isComponent = false) /// /// Visits dictionary of /// - internal void Walk(Dictionary? headers) + internal void Walk(IDictionary? headers) { if (headers == null) { @@ -764,7 +764,7 @@ internal void Walk(Dictionary? headers) /// /// Visits dictionary of /// - internal void Walk(Dictionary? callbacks) + internal void Walk(IDictionary? callbacks) { if (callbacks == null) { @@ -786,7 +786,7 @@ internal void Walk(Dictionary? callbacks) /// /// Visits dictionary of /// - internal void Walk(Dictionary? content) + internal void Walk(IDictionary? content) { if (content == null) { @@ -826,7 +826,7 @@ internal void Walk(OpenApiMediaType mediaType) /// /// Visits dictionary of /// - internal void Walk(Dictionary? encodings) + internal void Walk(IDictionary? encodings) { if (encodings == null) { @@ -961,7 +961,7 @@ internal void Walk(OpenApiDiscriminator? openApiDiscriminator) /// /// Visits dictionary of /// - internal void Walk(Dictionary? examples) + internal void Walk(IDictionary? examples) { if (examples == null) { @@ -1039,7 +1039,7 @@ internal void Walk(List examples) /// /// Visits a list of and child objects /// - internal void Walk(List schemas) + internal void Walk(IList schemas) { if (schemas == null) { @@ -1086,7 +1086,7 @@ internal void Walk(OpenApiOAuthFlow oAuthFlow) /// /// Visits dictionary of and child objects /// - internal void Walk(Dictionary? links) + internal void Walk(IDictionary? links) { if (links == null) { diff --git a/src/Microsoft.OpenApi/Services/OperationSearch.cs b/src/Microsoft.OpenApi/Services/OperationSearch.cs index fdda6c5ca..1d6f2a239 100644 --- a/src/Microsoft.OpenApi/Services/OperationSearch.cs +++ b/src/Microsoft.OpenApi/Services/OperationSearch.cs @@ -19,7 +19,7 @@ public class OperationSearch : OpenApiVisitorBase /// /// A list of operations from the operation search. /// - public List SearchResults => _searchResults; + public IList SearchResults => _searchResults; /// /// The OperationSearch constructor. @@ -57,7 +57,7 @@ public override void Visit(IOpenApiPathItem pathItem) /// Visits list of . /// /// The target list of . - public override void Visit(List parameters) + public override void Visit(IList parameters) { /* The Parameter.Explode property should be true * if Parameter.Style == Form; but OData query params diff --git a/src/Microsoft.OpenApi/Services/SearchResult.cs b/src/Microsoft.OpenApi/Services/SearchResult.cs index 2515dddc1..b0365628d 100644 --- a/src/Microsoft.OpenApi/Services/SearchResult.cs +++ b/src/Microsoft.OpenApi/Services/SearchResult.cs @@ -23,6 +23,6 @@ public class SearchResult /// /// Parameters object /// - public List? Parameters { get; set; } + public IList? Parameters { get; set; } } } diff --git a/src/Microsoft.OpenApi/Validations/OpenApiValidator.cs b/src/Microsoft.OpenApi/Validations/OpenApiValidator.cs index c94492215..7903298ce 100644 --- a/src/Microsoft.OpenApi/Validations/OpenApiValidator.cs +++ b/src/Microsoft.OpenApi/Validations/OpenApiValidator.cs @@ -145,21 +145,21 @@ public void AddWarning(OpenApiValidatorWarning warning) /// public override void Visit(OpenApiOperation operation) => Validate(operation); /// - public override void Visit(Dictionary operations) => Validate(operations, operations.GetType()); + public override void Visit(IDictionary operations) => Validate(operations, operations.GetType()); /// - public override void Visit(Dictionary headers) => Validate(headers, headers.GetType()); + public override void Visit(IDictionary headers) => Validate(headers, headers.GetType()); /// - public override void Visit(Dictionary callbacks) => Validate(callbacks, callbacks.GetType()); + public override void Visit(IDictionary callbacks) => Validate(callbacks, callbacks.GetType()); /// - public override void Visit(Dictionary content) => Validate(content, content.GetType()); + public override void Visit(IDictionary content) => Validate(content, content.GetType()); /// - public override void Visit(Dictionary examples) => Validate(examples, examples.GetType()); + public override void Visit(IDictionary examples) => Validate(examples, examples.GetType()); /// - public override void Visit(Dictionary links) => Validate(links, links.GetType()); + public override void Visit(IDictionary links) => Validate(links, links.GetType()); /// - public override void Visit(Dictionary serverVariables) => Validate(serverVariables, serverVariables.GetType()); + public override void Visit(IDictionary serverVariables) => Validate(serverVariables, serverVariables.GetType()); /// - public override void Visit(Dictionary encodings) => Validate(encodings, encodings.GetType()); + public override void Visit(IDictionary encodings) => Validate(encodings, encodings.GetType()); private void Validate(T item) { diff --git a/src/Microsoft.OpenApi/Validations/Rules/OpenApiNonDefaultRules.cs b/src/Microsoft.OpenApi/Validations/Rules/OpenApiNonDefaultRules.cs index 9ea627d14..5b3cd0a49 100644 --- a/src/Microsoft.OpenApi/Validations/Rules/OpenApiNonDefaultRules.cs +++ b/src/Microsoft.OpenApi/Validations/Rules/OpenApiNonDefaultRules.cs @@ -88,7 +88,7 @@ public static class OpenApiNonDefaultRules private static void ValidateMismatchedDataType(IValidationContext context, string ruleName, JsonNode? example, - Dictionary? examples, + IDictionary? examples, IOpenApiSchema? schema) { // example diff --git a/src/Microsoft.OpenApi/Validations/Rules/OpenApiSchemaRules.cs b/src/Microsoft.OpenApi/Validations/Rules/OpenApiSchemaRules.cs index 4ee58f94d..826eaa031 100644 --- a/src/Microsoft.OpenApi/Validations/Rules/OpenApiSchemaRules.cs +++ b/src/Microsoft.OpenApi/Validations/Rules/OpenApiSchemaRules.cs @@ -79,7 +79,7 @@ public static bool ValidateChildSchemaAgainstDiscriminator(IOpenApiSchema schema /// between other schemas which may satisfy the payload description. /// The child schema. /// - public static bool TraverseSchemaElements(string discriminatorName, List? childSchema) + public static bool TraverseSchemaElements(string discriminatorName, IList? childSchema) { if (childSchema is not null) { diff --git a/src/Microsoft.OpenApi/Validations/ValidationRuleSet.cs b/src/Microsoft.OpenApi/Validations/ValidationRuleSet.cs index 7f66c66f0..63baab84d 100644 --- a/src/Microsoft.OpenApi/Validations/ValidationRuleSet.cs +++ b/src/Microsoft.OpenApi/Validations/ValidationRuleSet.cs @@ -23,7 +23,7 @@ public sealed class ValidationRuleSet /// /// Gets the rules in this rule set. /// - public List Rules => _rulesDictionary.Values.SelectMany(v => v).ToList(); + public IList Rules => _rulesDictionary.Values.SelectMany(v => v).ToList(); /// /// Gets the number of elements contained in this rule set. @@ -42,7 +42,7 @@ public ValidationRuleSet() /// /// The type that is to be validated /// Either the rules related to the type, or an empty list. - public List FindRules(Type type) + public IList FindRules(Type type) { _rulesDictionary.TryGetValue(type, out var results); return results ?? _emptyRules; diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs index 98fe4daeb..34d0d9803 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs @@ -20,7 +20,7 @@ public static class OpenApiWriterAnyExtensions /// The Open API writer. /// The specification extensions. /// Version of the OpenAPI specification that that will be output. - public static void WriteExtensions(this IOpenApiWriter writer, Dictionary? extensions, OpenApiSpecVersion specVersion) + public static void WriteExtensions(this IOpenApiWriter writer, IDictionary? extensions, OpenApiSpecVersion specVersion) { Utils.CheckArgumentNull(writer); diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs index 16e0e485d..5974924c0 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs @@ -265,7 +265,7 @@ public static void WriteRequiredCollection( public static void WriteRequiredMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { writer.WriteMapInternal(name, elements, action); @@ -281,7 +281,7 @@ public static void WriteRequiredMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { if (elements != null && elements.Any()) @@ -300,7 +300,7 @@ public static void WriteOptionalMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { if (elements != null && elements.Any()) @@ -319,7 +319,7 @@ public static void WriteOptionalMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { if (elements != null && elements.Any()) @@ -338,7 +338,7 @@ public static void WriteOptionalMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary>? elements, + IDictionary>? elements, Action> action) { if (elements != null && elements.Any()) @@ -358,7 +358,7 @@ public static void WriteOptionalMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) where T : IOpenApiElement { @@ -379,7 +379,7 @@ public static void WriteOptionalMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) where T : IOpenApiElement { @@ -400,7 +400,7 @@ public static void WriteOptionalMap( public static void WriteRequiredMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) where T : IOpenApiElement { @@ -419,6 +419,13 @@ private static void WriteCollectionInternal( writer.WriteStartArray(); if (elements != null) { + var settings = writer.GetSettings(); + + if (settings?.KeyComparer is IComparer typedComparer) + { + elements = elements.Sort(typedComparer); + } + foreach (var item in elements) { if (item != null) @@ -438,7 +445,7 @@ private static void WriteCollectionInternal( private static void WriteMapInternal( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { WriteMapInternal(writer, name, elements, (w, _, s) => action(w, s)); @@ -447,7 +454,7 @@ private static void WriteMapInternal( private static void WriteMapInternal( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { Utils.CheckArgumentNull(action); @@ -457,6 +464,12 @@ private static void WriteMapInternal( if (elements != null) { + var settings = writer.GetSettings(); + if (settings?.KeyComparer != null) + { + elements = elements.Sort(settings.KeyComparer); // sort using custom comparer + } + foreach (var item in elements) { writer.WritePropertyName(item.Key); diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs index 1164bf849..cbd3344b2 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs @@ -1,4 +1,6 @@ -namespace Microsoft.OpenApi +using System.Collections.Generic; + +namespace Microsoft.OpenApi { /// /// Configuration settings to control how OpenAPI documents are written @@ -21,5 +23,10 @@ internal bool ShouldInlineReference(OpenApiReference reference) return (reference.IsLocal && InlineLocalReferences) || (reference.IsExternal && InlineExternalReferences); } + + /// + /// Specifies a comparer used to sort string-based collection keys, such as components or tags. + /// + public IComparer? KeyComparer { get; set; } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 2d6694b23..2fa6a86d4 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -120,7 +120,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() { Name = "ids", In = ParameterLocation.Query, - Content = new() + Content = new Dictionary() { { "application/json", @@ -139,7 +139,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() } } ], - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-operation-type", new JsonNodeExtension("function") @@ -153,12 +153,12 @@ private static OpenApiDocument GetSampleOpenApiDocument() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { { "TestSchema", new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "averageAudioDegradation", new OpenApiSchema diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index ce518f69a..da3821c56 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -92,7 +92,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -153,7 +153,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -201,7 +201,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved entities", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -211,7 +211,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Title = "Collection of user", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "value", @@ -247,7 +247,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved entity", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -310,7 +310,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved navigation property", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -357,7 +357,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -414,7 +414,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved navigation property", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -424,7 +424,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Title = "Collection of hostSecurityProfile", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "value", @@ -466,7 +466,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-key-type", new JsonNodeExtension("call") @@ -483,7 +483,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-operation-type", new JsonNodeExtension("action") @@ -514,7 +514,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-key-type", new JsonNodeExtension("group") @@ -531,7 +531,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-key-type", new JsonNodeExtension("event") @@ -545,7 +545,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -553,7 +553,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Schema = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { { "value", @@ -570,7 +570,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-operation-type", new JsonNodeExtension("function") @@ -596,14 +596,14 @@ public static OpenApiDocument CreateOpenApiDocument() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { { "microsoft.graph.networkInterface", new OpenApiSchema { Title = "networkInterface", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "description", new OpenApiSchema diff --git a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs index 610509813..b20f72e9a 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using Xunit; @@ -67,7 +68,7 @@ public async Task LoadResponseReference() new OpenApiResponse { Description = "Entity not found.", - Content = new() + Content = new Dictionary() { ["application/json"] = new() } @@ -84,7 +85,7 @@ public async Task LoadResponseAndSchemaReference() var expected = new OpenApiResponse { Description = "General Error", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs index 3c5c28f9d..5845e4bbf 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using System; +using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Threading; @@ -70,7 +71,7 @@ public async Task ShouldParseProducesInAnyOrder() var okSchema = new OpenApiSchema { - Properties = new() + Properties = new Dictionary() { { "id", new OpenApiSchema { @@ -83,7 +84,7 @@ public async Task ShouldParseProducesInAnyOrder() var errorSchema = new OpenApiSchema { - Properties = new() + Properties = new Dictionary() { { "code", new OpenApiSchema { @@ -145,7 +146,7 @@ public async Task ShouldParseProducesInAnyOrder() ["200"] = new OpenApiResponse() { Description = "An OK response", - Content = new() + Content = new Dictionary() { ["application/json"] = okMediaType, ["application/xml"] = okMediaType, @@ -154,7 +155,7 @@ public async Task ShouldParseProducesInAnyOrder() ["default"] = new OpenApiResponse() { Description = "An error response", - Content = new() + Content = new Dictionary() { ["application/json"] = errorMediaType, ["application/xml"] = errorMediaType @@ -169,7 +170,7 @@ public async Task ShouldParseProducesInAnyOrder() ["200"] = new OpenApiResponse() { Description = "An OK response", - Content = new() + Content = new Dictionary() { ["html/text"] = okMediaType } @@ -177,7 +178,7 @@ public async Task ShouldParseProducesInAnyOrder() ["default"] = new OpenApiResponse() { Description = "An error response", - Content = new() + Content = new Dictionary() { ["html/text"] = errorMediaType } @@ -191,7 +192,7 @@ public async Task ShouldParseProducesInAnyOrder() ["200"] = new OpenApiResponse() { Description = "An OK response", - Content = new() + Content = new Dictionary() { ["application/json"] = okMediaType, ["application/xml"] = okMediaType, @@ -200,7 +201,7 @@ public async Task ShouldParseProducesInAnyOrder() ["default"] = new OpenApiResponse() { Description = "An error response", - Content = new() + Content = new Dictionary() { ["application/json"] = errorMediaType, ["application/xml"] = errorMediaType @@ -213,7 +214,7 @@ public async Task ShouldParseProducesInAnyOrder() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["Item"] = okSchema, ["Error"] = errorSchema diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs index 5dfd21986..bb7dfca0a 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs @@ -45,7 +45,7 @@ public class OpenApiOperationTests ["200"] = new OpenApiResponse { Description = "Pet updated.", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType(), ["application/xml"] = new OpenApiMediaType() @@ -77,7 +77,7 @@ public class OpenApiOperationTests { Description = "Pet to update with", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -87,7 +87,7 @@ public class OpenApiOperationTests } } }, - Extensions = new() + Extensions = new Dictionary() { [OpenApiConstants.BodyName] = new JsonNodeExtension("petObject") } @@ -97,7 +97,7 @@ public class OpenApiOperationTests ["200"] = new OpenApiResponse { Description = "Pet updated.", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType(), ["application/xml"] = new OpenApiMediaType() @@ -106,7 +106,7 @@ public class OpenApiOperationTests ["405"] = new OpenApiResponse { Description = "Invalid input", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType(), ["application/xml"] = new OpenApiMediaType() @@ -208,7 +208,7 @@ public void ParseOperationWithResponseExamplesShouldSucceed() { "200", new OpenApiResponse() { Description = "An array of float response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType() { @@ -527,7 +527,7 @@ public async Task SerializesBodyReferencesWorks() openApiDocument.AddComponent("UserRequest", new OpenApiRequestBody { Description = "User creation request body", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs index 36f4fbba6..bc62ac86e 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs @@ -61,14 +61,14 @@ public class OpenApiPathItemTests ], RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/x-www-form-urlencoded"] = new() { Schema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -92,7 +92,7 @@ public class OpenApiPathItemTests Schema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -118,7 +118,7 @@ public class OpenApiPathItemTests ["200"] = new OpenApiResponse() { Description = "Pet updated.", - Content = new() + Content = new Dictionary() { ["application/json"] = new(), ["application/xml"] = new() @@ -127,7 +127,7 @@ public class OpenApiPathItemTests ["405"] = new OpenApiResponse() { Description = "Invalid input", - Content = new() + Content = new Dictionary() { ["application/json"] = new(), ["application/xml"] = new() @@ -167,14 +167,14 @@ public class OpenApiPathItemTests ], RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/x-www-form-urlencoded"] = new() { Schema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -203,7 +203,7 @@ public class OpenApiPathItemTests Schema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -221,10 +221,10 @@ public class OpenApiPathItemTests Type = JsonSchemaType.String } }, - Required = - [ + Required = new HashSet + { "name" - ] + } } } } @@ -234,7 +234,7 @@ public class OpenApiPathItemTests ["200"] = new OpenApiResponse() { Description = "Pet updated.", - Content = new() + Content = new Dictionary() { ["application/json"] = new(), ["application/xml"] = new() diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs index 248c9677d..41f5b9f62 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.IO; using System.Text.Json.Nodes; using System.Threading.Tasks; @@ -106,7 +107,7 @@ public void PropertiesReferenceShouldWork() var targetSchema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["prop1"] = new OpenApiSchema() { @@ -114,7 +115,7 @@ public void PropertiesReferenceShouldWork() } } }; - workingDocument.Components.Schemas = new() + workingDocument.Components.Schemas = new Dictionary() { [referenceId] = targetSchema }; @@ -122,7 +123,7 @@ public void PropertiesReferenceShouldWork() var referenceSchema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["propA"] = new OpenApiSchemaReference(referenceId, workingDocument), } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs index ef220d9a7..ddcd2736d 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs @@ -27,7 +27,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() var components = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["petSchema"] = new OpenApiSchema() { @@ -41,7 +41,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() { { "tag", new HashSet { "category" } } }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -73,7 +73,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() { { "tag", new HashSet { "category" } } }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -149,7 +149,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -177,7 +177,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() { Description = "Information about a new pet in the system", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -190,7 +190,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() ["200"] = new OpenApiResponse { Description = "Return a 200 status to indicate that the data was received successfully", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -219,7 +219,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() var components = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["petSchema"] = new OpenApiSchema() { @@ -233,7 +233,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() { { "tag", new HashSet { "category" } } }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -265,7 +265,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() { { "tag", new HashSet { "category" } } }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -339,7 +339,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -367,7 +367,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() { Description = "Information about a new pet in the system", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -380,7 +380,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() ["200"] = new OpenApiResponse { Description = "Return a 200 status to indicate that the data was received successfully", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -442,7 +442,7 @@ public async Task ParseDocumentWithPatternPropertiesInSchemaWorks() var expectedSchema = new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["prop1"] = new OpenApiSchema { @@ -457,7 +457,7 @@ public async Task ParseDocumentWithPatternPropertiesInSchemaWorks() Type = JsonSchemaType.String } }, - PatternProperties = new() + PatternProperties = new Dictionary() { ["^x-.*$"] = new OpenApiSchema { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs index f2d756c8b..72fb153dd 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs @@ -36,7 +36,7 @@ public async Task ParseBasicV31SchemaShouldSucceed() Schema = new Uri("https://json-schema.org/draft/2020-12/schema"), Description = "A representation of a person, company, organization, or place", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["fruits"] = new OpenApiSchema { @@ -65,7 +65,7 @@ public async Task ParseBasicV31SchemaShouldSucceed() { { "veggieType", new HashSet { "veggieColor", "veggieSize" } } }, - Properties = new() + Properties = new Dictionary() { ["veggieName"] = new OpenApiSchema { @@ -176,7 +176,7 @@ public async Task ParseV31SchemaShouldSucceed() var expectedSchema = new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["one"] = new OpenApiSchema() { @@ -200,7 +200,7 @@ public async Task ParseAdvancedV31SchemaShouldSucceed() var expectedSchema = new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["one"] = new OpenApiSchema() { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs index 4a8473827..370743141 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs @@ -182,7 +182,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() var components = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["pet1"] = new OpenApiSchema() { @@ -192,7 +192,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() "id", "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -216,7 +216,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() { "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -241,7 +241,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() "code", "message" }, - Properties = new() + Properties = new Dictionary() { ["code"] = new OpenApiSchema() { @@ -335,7 +335,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -358,7 +358,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -369,7 +369,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -387,7 +387,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() { Description = "Pet to add to the store", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -400,7 +400,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -411,7 +411,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -422,7 +422,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -463,7 +463,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -478,7 +478,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -489,7 +489,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -527,7 +527,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -538,7 +538,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -568,7 +568,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() var components = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["pet1"] = new OpenApiSchema() { @@ -578,7 +578,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() "id", "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -602,7 +602,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() { "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -627,7 +627,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() "code", "message" }, - Properties = new() + Properties = new Dictionary() { ["code"] = new OpenApiSchema() { @@ -759,7 +759,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -782,7 +782,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -793,7 +793,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -816,7 +816,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() { Description = "Pet to add to the store", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -829,7 +829,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -840,7 +840,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -851,7 +851,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -904,7 +904,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -919,7 +919,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -930,7 +930,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -968,7 +968,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -979,7 +979,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -1239,7 +1239,7 @@ public async Task SerializesDoubleHopeReferences() { Type = JsonSchemaType.Object, Description = "A pet", - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema { @@ -1275,7 +1275,7 @@ public async Task SerializesDoubleHopeReferences() ["200"] = new OpenApiResponse { Description = "A list of pets", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs index 0a4a4ccd1..fe1690122 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs @@ -107,7 +107,7 @@ public async Task ParseQueryParameterWithObjectTypeAndContentShouldSucceed() { In = ParameterLocation.Query, Name = "coordinates", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -119,7 +119,7 @@ public async Task ParseQueryParameterWithObjectTypeAndContentShouldSucceed() "lat", "long" }, - Properties = new() + Properties = new Dictionary() { ["lat"] = new OpenApiSchema() { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs index 80b0d3d3c..aea5d46a4 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs @@ -190,7 +190,7 @@ public void ParseBasicSchemaWithExampleShouldSucceed() new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -236,12 +236,12 @@ public async Task ParseBasicSchemaWithReferenceShouldSucceed() var expectedComponents = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["ErrorModel"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["code"] = new OpenApiSchema() { @@ -269,7 +269,7 @@ public async Task ParseBasicSchemaWithReferenceShouldSucceed() { Type = JsonSchemaType.Object, Required = new HashSet {"rootCause"}, - Properties = new() + Properties = new Dictionary() { ["rootCause"] = new OpenApiSchema() { @@ -293,7 +293,7 @@ public async Task ParseAdvancedSchemaWithReferenceShouldSucceed() var expectedComponents = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["Pet"] = new OpenApiSchema() { @@ -302,7 +302,7 @@ public async Task ParseAdvancedSchemaWithReferenceShouldSucceed() { PropertyName = "petType" }, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -329,7 +329,7 @@ public async Task ParseAdvancedSchemaWithReferenceShouldSucceed() { Type = JsonSchemaType.Object, Required = new HashSet{"huntingSkill"}, - Properties = new() + Properties = new Dictionary() { ["huntingSkill"] = new OpenApiSchema() { @@ -357,7 +357,7 @@ public async Task ParseAdvancedSchemaWithReferenceShouldSucceed() { Type = JsonSchemaType.Object, Required = new HashSet{"packSize"}, - Properties = new() + Properties = new Dictionary() { ["packSize"] = new OpenApiSchema() { @@ -399,7 +399,7 @@ public async Task ParseExternalReferenceSchemaShouldSucceed() var expectedComponents = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["RelativePathModel"] = new OpenApiSchema() { diff --git a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt new file mode 100644 index 000000000..316c35558 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt @@ -0,0 +1,57 @@ +swagger: '2.0' +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + consumes: + - application/json + parameters: + - in: body + name: body + description: Information about a new pet in the system + schema: + $ref: '#/definitions/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +definitions: + errorModel: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + type: object + required: + - name + properties: + id: + type: integer + format: int64 + name: + type: string + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt new file mode 100644 index 000000000..ca83e6790 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt @@ -0,0 +1,56 @@ +openapi: 3.0.4 +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +components: + schemas: + errorModel: + required: + - code + - message + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + required: + - name + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt new file mode 100644 index 000000000..78392d7e5 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt @@ -0,0 +1,56 @@ +openapi: '3.1.1' +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +components: + schemas: + errorModel: + required: + - code + - message + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + required: + - name + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt new file mode 100644 index 000000000..e285124a9 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt @@ -0,0 +1,57 @@ +swagger: '2.0' +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + consumes: + - application/json + parameters: + - in: body + name: body + description: Information about a new pet in the system + schema: + $ref: '#/definitions/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +definitions: + errorModel: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + type: object + required: + - name + properties: + id: + type: integer + format: int64 + name: + type: string + pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt new file mode 100644 index 000000000..da60b8ac2 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt @@ -0,0 +1,56 @@ +openapi: 3.0.4 +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +components: + schemas: + errorModel: + required: + - code + - message + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + required: + - name + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt new file mode 100644 index 000000000..dbab6f41a --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt @@ -0,0 +1,56 @@ +openapi: '3.1.1' +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +components: + schemas: + errorModel: + required: + - code + - message + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + required: + - name + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs new file mode 100644 index 000000000..49d8e325a --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs @@ -0,0 +1,221 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Net.Http; +using System.Threading.Tasks; +using VerifyXunit; +using Xunit; + +namespace Microsoft.OpenApi.Tests.Extensions +{ + public class CollectionExtensionsTests + { + public static readonly OpenApiDocument Document = new OpenApiDocument + { + Info = new OpenApiInfo { Title = "Test API", Version = "1.0" }, + Paths = new OpenApiPaths + { + ["pet"] = new OpenApiPathItem + { + Operations = new () + { + [HttpMethod.Get] = new OpenApiOperation + { + Responses = new OpenApiResponses + { + ["200"] = new OpenApiResponse + { + Description = "Return a 200 status to indicate that the data was received successfully" + } + } + } + } + }, + ["newPet"] = new OpenApiPathItem + { + Operations = new() + { + [HttpMethod.Post] = new OpenApiOperation + { + RequestBody = new OpenApiRequestBody + { + Description = "Information about a new pet in the system", + Content = new Dictionary() + { + ["application/json"] = new OpenApiMediaType + { + Schema = new OpenApiSchemaReference("Pet", null) + } + } + }, + Responses = new OpenApiResponses + { + ["200"] = new OpenApiResponse + { + Description = "Return a 200 status to indicate that the data was received successfully" + } + } + } + } + } + }, + Components = new OpenApiComponents + { + Schemas = new Dictionary() + { + ["pet"] = new OpenApiSchema() + { + Required = new HashSet + { + "id", "name" + }, + Properties = new Dictionary() + { + ["name"] = new OpenApiSchema() + { + Type = JsonSchemaType.String + }, + ["id"] = new OpenApiSchema() + { + Type = JsonSchemaType.Integer, + Format = "int64" + }, + ["tag"] = new OpenApiSchema() + { + Type = JsonSchemaType.String + } + }, + }, + ["newPet"] = new OpenApiSchema() + { + Type = JsonSchemaType.Object, + Required = new HashSet + { + "name" + }, + Properties = new Dictionary() + { + ["name"] = new OpenApiSchema() + { + Type = JsonSchemaType.String + }, + ["id"] = new OpenApiSchema() + { + Type = JsonSchemaType.Integer, + Format = "int64" + } + } + }, + ["errorModel"] = new OpenApiSchema() + { + Type = JsonSchemaType.Object, + Required = new HashSet + { + "code", + "message" + }, + Properties = new Dictionary() + { + ["message"] = new OpenApiSchema() + { + Type = JsonSchemaType.String + }, + ["code"] = new OpenApiSchema() + { + Type = JsonSchemaType.Integer, + Format = "int32" + } + } + } + } + } + }; + + [Theory] + [MemberData(nameof(OpenApiSpecVersions))] + public async Task SortOpenApiDocumentUsingCustomComparerSucceeds(OpenApiSpecVersion version) + { + // Arrange + var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); + var settings = new OpenApiWriterSettings + { + KeyComparer = StringComparer.OrdinalIgnoreCase + }; + var writer = new OpenApiYamlWriter(outputStringWriter, settings); + + // Act + Document.SerializeAs(version, writer); + await writer.FlushAsync(); + + // Assert + await Verifier.Verify(outputStringWriter).UseParameters(version); + } + + [Fact] + public async Task SortHashSetsWorks() + { + // Arrange + var expected = @"required: + - id + - name + - tag"; + var schema = new OpenApiSchema + { + Required = new HashSet { "tag", "id", "name" }, + }; + + var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); + var settings = new OpenApiWriterSettings + { + KeyComparer = StringComparer.OrdinalIgnoreCase + }; + var writer = new OpenApiYamlWriter(outputStringWriter, settings); + + // Act + schema.SerializeAsV3(writer); + await writer.FlushAsync(); + var sortedString = outputStringWriter.ToString(); + + // Assert + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), sortedString.MakeLineBreaksEnvironmentNeutral()); + } + + [Fact] + public void SortTagsByNameUsingComparerWorks() + { + // Arrange + var tags = new HashSet + { + new() { Name = "three" }, + new() { Name = "two" }, + new() { Name = "one" } + }; + + // Act + var sortedTags = tags.Sort(new OpenApiTagNameComparer()); + + // Assert + Assert.Equal(3, sortedTags.Count); + Assert.True(sortedTags[0].Name == "one"); + } + + public static TheoryData OpenApiSpecVersions() + { + var values = new TheoryData(); + foreach (var value in Enum.GetValues()) + { + values.Add(value); + } + return values; + } + } + + public class OpenApiTagNameComparer : IComparer + { + public int Compare(OpenApiTag tag1, OpenApiTag tag2) + { + return string.Compare(tag1.Name, tag2.Name, StringComparison.OrdinalIgnoreCase); + } + } +} diff --git a/test/Microsoft.OpenApi.Tests/Extensions/Samples/petStore.yaml b/test/Microsoft.OpenApi.Tests/Extensions/Samples/petStore.yaml new file mode 100644 index 000000000..6a9df318b --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/Samples/petStore.yaml @@ -0,0 +1,190 @@ +openapi: '3.0.0' +info: + version: '1.0.0' + title: Swagger Petstore (Simple) + description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + termsOfService: http://helloreverb.com/terms/ + contact: + name: Swagger API team + email: foo@example.com + url: http://swagger.io + license: + name: MIT + url: http://opensource.org/licenses/MIT +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: Returns all pets from the system that the user has access to + operationId: findPets + parameters: + - name: tags + in: query + description: tags to filter by + required: false + schema: + type: array + items: + type: string + - name: limit + in: query + description: maximum number of results to return + required: false + schema: + type: integer + format: int32 + responses: + '200': + description: pet response + content: + application/json: + schema: + type: array + items: + "$ref": '#/components/schemas/pet1' + application/xml: + schema: + type: array + items: + "$ref": '#/components/schemas/pet1' + + '4XX': + description: unexpected client error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + '5XX': + description: unexpected server error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + post: + description: Creates a new pet in the store. Duplicates are allowed + operationId: addPet + requestBody: + description: Pet to add to the store + required: true + content: + 'application/json': + schema: + "$ref": '#/components/schemas/newPet' + responses: + '200': + description: pet response + content: + application/json: + schema: + "$ref": '#/components/schemas/pet1' + '4XX': + description: unexpected client error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + '5XX': + description: unexpected server error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + /pets/{id}: + get: + description: Returns a user based on a single ID, if the user does not have access to the pet + operationId: findPetById + parameters: + - name: id + in: path + description: ID of pet to fetch + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: pet response + content: + application/json: + schema: + "$ref": '#/components/schemas/pet1' + application/xml: + schema: + "$ref": '#/components/schemas/pet1' + '4XX': + description: unexpected client error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + '5XX': + description: unexpected server error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + delete: + description: deletes a single pet based on the ID supplied + operationId: deletePet + parameters: + - name: id + in: path + description: ID of pet to delete + required: true + schema: + type: integer + format: int64 + responses: + '204': + description: pet deleted + '4XX': + description: unexpected client error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + '5XX': + description: unexpected server error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' +components: + schemas: + pet1: + type: object + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + newPet: + type: object + required: + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + errorModel: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj index 9f65e7c78..58950a1ea 100644 --- a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj +++ b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj @@ -39,6 +39,30 @@ + + CollectionExtensionsTests.cs + + + + CollectionExtensionsTests.cs + + + + CollectionExtensionsTests.cs + + + + CollectionExtensionsTests.cs + + + + CollectionExtensionsTests.cs + + + + CollectionExtensionsTests.cs + + OpenApiCallbackReferenceTests.cs @@ -65,4 +89,8 @@ PreserveNewest + + + + \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs index ace48765e..3b42f1e08 100644 --- a/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs @@ -39,7 +39,7 @@ public static OpenApiDocument CreateCompleteOpenApiDocument() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -281,7 +281,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["name"] = new OpenApiSchema { Type = JsonSchemaType.String }, ["tag"] = new OpenApiSchema { Type = JsonSchemaType.String } }, - Required = ["id", "name"] + Required = new HashSet { "id", "name" } } }, Parameters = new Dictionary @@ -436,14 +436,13 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = } } ], - Tags = - [ - new OpenApiTag - { + Tags = new HashSet + { + new() { Name = "pets", Description = "Operations related to pets" } - ], + }, ExternalDocs = new OpenApiExternalDocs { Description = "Find out more", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs index 5bc03bfc6..e6cfa8007 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs @@ -28,7 +28,7 @@ public class OpenApiCallbackTests { RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -68,7 +68,7 @@ public class OpenApiCallbackTests { RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs index 0f685ce98..190da253c 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs @@ -13,11 +13,11 @@ public class OpenApiComponentsTests { public static OpenApiComponents AdvancedComponents = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -62,11 +62,11 @@ public class OpenApiComponentsTests public static OpenApiComponents AdvancedComponentsWithReference = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -77,7 +77,7 @@ public class OpenApiComponentsTests }, ["schema2"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -119,7 +119,7 @@ public class OpenApiComponentsTests public static OpenApiComponents BrokenComponents = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { @@ -147,13 +147,13 @@ public class OpenApiComponentsTests public static OpenApiComponents TopLevelReferencingComponents = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchemaReference("schema2", null), ["schema2"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -166,12 +166,12 @@ public class OpenApiComponentsTests public static OpenApiComponents TopLevelSelfReferencingComponentsWithOtherProperties = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -182,7 +182,7 @@ public class OpenApiComponentsTests ["schema2"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -195,7 +195,7 @@ public class OpenApiComponentsTests public static OpenApiComponents TopLevelSelfReferencingComponents = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchemaReference("schema1", null) } @@ -203,11 +203,11 @@ public class OpenApiComponentsTests public static OpenApiComponents ComponentsWithPathItem = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -219,7 +219,7 @@ public class OpenApiComponentsTests ["schema2"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -239,7 +239,7 @@ public class OpenApiComponentsTests RequestBody = new OpenApiRequestBody { Description = "Information about a new pet in the system", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs index 633ec1ab8..f699b2f40 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.Threading.Tasks; using Xunit; @@ -16,7 +17,7 @@ public class OpenApiContactTests Name = "API Support", Url = new("http://www.example.com/support"), Email = "support@example.com", - Extensions = new() + Extensions = new Dictionary() { {"x-internal-id", new JsonNodeExtension(42)} } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index cba489148..5e3644f1b 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs @@ -17,13 +17,13 @@ public class OpenApiDocumentTests { public static readonly OpenApiComponents TopLevelReferencingComponents = new OpenApiComponents() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchemaReference("schema2", null), ["schema2"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -37,12 +37,12 @@ public class OpenApiDocumentTests public static readonly OpenApiComponents TopLevelSelfReferencingComponentsWithOtherProperties = new OpenApiComponents() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -55,7 +55,7 @@ public class OpenApiDocumentTests ["schema2"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -69,7 +69,7 @@ public class OpenApiDocumentTests public static readonly OpenApiComponents TopLevelSelfReferencingComponents = new OpenApiComponents() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { @@ -109,7 +109,7 @@ public class OpenApiDocumentTests public static readonly OpenApiComponents AdvancedComponentsWithReference = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["pet"] = new OpenApiSchema() { @@ -119,7 +119,7 @@ public class OpenApiDocumentTests "id", "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -143,7 +143,7 @@ public class OpenApiDocumentTests { "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -168,7 +168,7 @@ public class OpenApiDocumentTests "code", "message" }, - Properties = new() + Properties = new Dictionary() { ["code"] = new OpenApiSchema() { @@ -264,7 +264,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -287,7 +287,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -298,7 +298,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -316,7 +316,7 @@ public class OpenApiDocumentTests { Description = "Pet to add to the store", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -329,7 +329,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -340,7 +340,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -351,7 +351,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -392,7 +392,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -407,7 +407,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -418,7 +418,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -456,7 +456,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -467,7 +467,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -486,7 +486,7 @@ public class OpenApiDocumentTests public static readonly OpenApiComponents AdvancedComponents = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["pet"] = new OpenApiSchema() { @@ -496,7 +496,7 @@ public class OpenApiDocumentTests "id", "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -520,7 +520,7 @@ public class OpenApiDocumentTests { "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -545,7 +545,7 @@ public class OpenApiDocumentTests "code", "message" }, - Properties = new() + Properties = new Dictionary() { ["code"] = new OpenApiSchema() { @@ -640,7 +640,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -663,7 +663,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -674,7 +674,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -692,7 +692,7 @@ public class OpenApiDocumentTests { Description = "Pet to add to the store", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -705,7 +705,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -716,7 +716,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -727,7 +727,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -768,7 +768,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -783,7 +783,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -794,7 +794,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -832,7 +832,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -843,7 +843,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -878,7 +878,7 @@ public class OpenApiDocumentTests RequestBody = new OpenApiRequestBody { Description = "Information about a new pet in the system", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -899,7 +899,7 @@ public class OpenApiDocumentTests }, Components = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["Pet"] = new OpenApiSchema() { @@ -907,7 +907,7 @@ public class OpenApiDocumentTests { "id", "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -963,12 +963,12 @@ public class OpenApiDocumentTests Schema = new OpenApiSchema() { Type = JsonSchemaType.Integer, - Extensions = new() + Extensions = new Dictionary() { ["my-extension"] = new JsonNodeExtension(4) } }, - Extensions = new() + Extensions = new Dictionary() { ["my-extension"] = new JsonNodeExtension(4), } @@ -982,12 +982,12 @@ public class OpenApiDocumentTests Schema = new OpenApiSchema() { Type = JsonSchemaType.Integer, - Extensions = new() + Extensions = new Dictionary() { ["my-extension"] = new JsonNodeExtension(4) } }, - Extensions = new() + Extensions = new Dictionary() { ["my-extension"] = new JsonNodeExtension(4), } @@ -998,7 +998,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -1099,7 +1099,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse() { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -1122,7 +1122,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse() { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1133,7 +1133,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse() { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1151,7 +1151,7 @@ public class OpenApiDocumentTests { Description = "Pet to add to the store", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -1164,7 +1164,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse() { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -1175,7 +1175,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse() { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1186,7 +1186,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse() { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1227,7 +1227,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse() { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -1242,7 +1242,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse() { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1253,7 +1253,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse() { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1291,7 +1291,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse() { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1302,7 +1302,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse() { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1533,7 +1533,7 @@ public async Task SerializeDocumentWithReferenceButNoComponents() { ["200"] = new OpenApiResponse { - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -1790,7 +1790,7 @@ public async Task SerializeV2DocumentWithStyleAsNullDoesNotWriteOutStyleValue() ["200"] = new OpenApiResponse { Description = "foo", - Content = new() + Content = new Dictionary() { ["text/plain"] = new OpenApiMediaType { @@ -1821,7 +1821,7 @@ public void OpenApiDocumentCopyConstructorWithAnnotationsSucceeds() { var baseDocument = new OpenApiDocument { - Metadata = new() + Metadata = new Dictionary { ["key1"] = "value1", ["key2"] = 2 @@ -1852,7 +1852,7 @@ public void SerializeExamplesDoesNotThrowNullReferenceException() { RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType() { @@ -2069,7 +2069,7 @@ public async Task SerializeDocumentTagsWithMultipleExtensionsWorks() new OpenApiTag { Name = "tag1", - Extensions = new() + Extensions = new Dictionary() { ["x-tag1"] = new JsonNodeExtension("tag1") } @@ -2077,7 +2077,7 @@ public async Task SerializeDocumentTagsWithMultipleExtensionsWorks() new OpenApiTag { Name = "tag2", - Extensions = new() + Extensions = new Dictionary() { ["x-tag2"] = new JsonNodeExtension("tag2") } @@ -2098,7 +2098,7 @@ public void DeduplicatesTags() new OpenApiTag { Name = "tag1", - Extensions = new() + Extensions = new Dictionary() { ["x-tag1"] = new JsonNodeExtension("tag1") } @@ -2106,7 +2106,7 @@ public void DeduplicatesTags() new OpenApiTag { Name = "tag2", - Extensions = new() + Extensions = new Dictionary() { ["x-tag2"] = new JsonNodeExtension("tag2") } @@ -2114,7 +2114,7 @@ public void DeduplicatesTags() new OpenApiTag { Name = "tag1", - Extensions = new() + Extensions = new Dictionary() { ["x-tag1"] = new JsonNodeExtension("tag1") } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs index 707fdcfff..57c3e1c7e 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs @@ -18,7 +18,7 @@ public class OpenApiInfoTests Contact = OpenApiContactTests.AdvanceContact, License = OpenApiLicenseTests.AdvanceLicense, Version = "1.1.1", - Extensions = new() + Extensions = new Dictionary() { {"x-updated", new JsonNodeExtension("metadata")} } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs index e9c90a7ee..58cdae2ce 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.Threading.Tasks; using Xunit; @@ -18,7 +19,7 @@ public class OpenApiLicenseTests { Name = "Apache 2.0", Url = new("http://www.apache.org/licenses/LICENSE-2.0.html"), - Extensions = new() + Extensions = new Dictionary() { {"x-copyright", new JsonNodeExtension("Abc")} } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs index 8d4512143..f67e82356 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs @@ -120,7 +120,7 @@ public void LinkExtensionsSerializationWorks() // Arrange var link = new OpenApiLink() { - Extensions = new() + Extensions = new Dictionary() { { "x-display", new JsonNodeExtension("Abc") } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs index 6becf3bcf..ff9c8badb 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs @@ -433,7 +433,7 @@ public void MediaTypeCopyConstructorWorks() Example = 42, Examples = new Dictionary(), Encoding = new Dictionary(), - Extensions = new() + Extensions = new Dictionary() }; // Assert diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs index 1e52385d9..cc0b485e1 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs @@ -40,7 +40,7 @@ public class OpenApiOperationTests { Description = "description2", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -58,7 +58,7 @@ public class OpenApiOperationTests ["200"] = new OpenApiResponseReference("response1"), ["400"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -114,7 +114,7 @@ public class OpenApiOperationTests { Description = "description2", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -132,7 +132,7 @@ public class OpenApiOperationTests ["200"] = new OpenApiResponseReference("response1"), ["400"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -218,13 +218,13 @@ private static OpenApiDocument __advancedOperationWithTagsAndSecurity_supporting ], RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/x-www-form-urlencoded"] = new() { Schema = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -247,7 +247,7 @@ private static OpenApiDocument __advancedOperationWithTagsAndSecurity_supporting { Schema = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs index a430139cd..5da25b013 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Threading.Tasks; @@ -16,7 +17,7 @@ public class OpenApiRequestBodyTests { Description = "description", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -33,7 +34,7 @@ public class OpenApiRequestBodyTests { Description = "description", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new() { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs index 43a8669b7..15c392466 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs @@ -28,7 +28,7 @@ public class OpenApiResponseTests Items = new OpenApiSchemaReference("customType", null) }, Example = "Blabla", - Extensions = new() + Extensions = new Dictionary() { ["myextension"] = new JsonNodeExtension("myextensionvalue"), }, @@ -67,7 +67,7 @@ public class OpenApiResponseTests Items = new OpenApiSchemaReference("customType", null) }, Example = "Blabla", - Extensions = new() + Extensions = new Dictionary() { ["myextension"] = new JsonNodeExtension("myextensionvalue"), }, diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs index c2a142bc4..ef5ca3d59 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs @@ -37,11 +37,11 @@ public class OpenApiSchemaTests public static readonly OpenApiSchema AdvancedSchemaObject = new() { Title = "title1", - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -56,11 +56,11 @@ public class OpenApiSchemaTests }, ["property4"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property5"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property6"] = new OpenApiSchema() { @@ -91,7 +91,7 @@ public class OpenApiSchemaTests new OpenApiSchema() { Title = "title2", - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -107,11 +107,11 @@ public class OpenApiSchemaTests new OpenApiSchema() { Title = "title3", - Properties = new() + Properties = new Dictionary() { ["property3"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property4"] = new OpenApiSchema() { @@ -154,12 +154,12 @@ public class OpenApiSchemaTests { Title = "title1", Required = new HashSet { "property1" }, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { Required = new HashSet { "property3" }, - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -176,11 +176,11 @@ public class OpenApiSchemaTests }, ["property4"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property5"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property6"] = new OpenApiSchema() { @@ -529,7 +529,7 @@ public void CloningSchemaExtensionsWorks() // Arrange var schema = new OpenApiSchema { - Extensions = new() + Extensions = new Dictionary() { { "x-myextension", new JsonNodeExtension(42) } } @@ -540,7 +540,7 @@ public void CloningSchemaExtensionsWorks() Assert.Single(schemaCopy.Extensions); // Act && Assert - schemaCopy.Extensions = new() + schemaCopy.Extensions = new Dictionary() { { "x-myextension" , new JsonNodeExtension(40) } }; diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs index 189bbc06d..2110e473b 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Threading.Tasks; @@ -19,7 +20,7 @@ public class OpenApiTagTests Name = "pet", Description = "Pets operations", ExternalDocs = OpenApiExternalDocsTests.AdvanceExDocs, - Extensions = new() + Extensions = new Dictionary() { {"x-tag-extension", null} } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs index 3c2c96b39..5424e1eb9 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.Threading.Tasks; using Xunit; @@ -16,7 +17,7 @@ public class OpenApiXmlTests Prefix = "sample", Wrapped = true, Attribute = true, - Extensions = new() + Extensions = new Dictionary() { {"x-xml-extension", new JsonNodeExtension(7)} } diff --git a/test/Microsoft.OpenApi.Tests/OpenApiTagComparerTests.cs b/test/Microsoft.OpenApi.Tests/OpenApiTagComparerTests.cs index f63c134b9..4c931b59f 100644 --- a/test/Microsoft.OpenApi.Tests/OpenApiTagComparerTests.cs +++ b/test/Microsoft.OpenApi.Tests/OpenApiTagComparerTests.cs @@ -76,7 +76,7 @@ public void SameReferenceIdAreEqualWithValidTagReferences() { var document = new OpenApiDocument { - Tags = [new() { Name = "tag" }] + Tags = new HashSet { new() { Name = "tag" } } }; var openApiTag1 = new OpenApiTagReference("tag", document); @@ -89,11 +89,11 @@ public void DifferentReferenceIdAreNotEqualWithValidTagReferences() { var document = new OpenApiDocument { - Tags = - [ + Tags = new HashSet + { new() { Name = "one" }, new() { Name = "two" }, - ] + } }; var openApiTag1 = new OpenApiTagReference("one", document); @@ -131,12 +131,12 @@ public void WorksCorrectlyWithHashSetOfReferencesToValidTags() { var document = new OpenApiDocument { - Tags = - [ + Tags = new HashSet + { new() { Name = "one" }, new() { Name = "two" }, new() { Name = "three" } - ] + } }; var tags = new HashSet(_comparer) diff --git a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt index 667f7b75f..19248ec7b 100644 --- a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt +++ b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt @@ -78,7 +78,7 @@ namespace Microsoft.OpenApi public interface IDiagnostic { } public interface IMetadataContainer { - System.Collections.Generic.Dictionary? Metadata { get; set; } + System.Collections.Generic.IDictionary? Metadata { get; set; } } public interface IOpenApiCallback : Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { @@ -96,7 +96,7 @@ namespace Microsoft.OpenApi } public interface IOpenApiExtensible : Microsoft.OpenApi.IOpenApiElement { - System.Collections.Generic.Dictionary? Extensions { get; set; } + System.Collections.Generic.IDictionary? Extensions { get; set; } } public interface IOpenApiExtension { @@ -106,10 +106,10 @@ namespace Microsoft.OpenApi { bool AllowEmptyValue { get; } bool AllowReserved { get; } - System.Collections.Generic.Dictionary? Content { get; } + System.Collections.Generic.IDictionary? Content { get; } bool Deprecated { get; } System.Text.Json.Nodes.JsonNode? Example { get; } - System.Collections.Generic.Dictionary? Examples { get; } + System.Collections.Generic.IDictionary? Examples { get; } bool Explode { get; } bool Required { get; } Microsoft.OpenApi.IOpenApiSchema? Schema { get; } @@ -119,7 +119,7 @@ namespace Microsoft.OpenApi { string? OperationId { get; } string? OperationRef { get; } - System.Collections.Generic.Dictionary? Parameters { get; } + System.Collections.Generic.IDictionary? Parameters { get; } Microsoft.OpenApi.RuntimeExpressionAnyWrapper? RequestBody { get; } Microsoft.OpenApi.OpenApiServer? Server { get; } } @@ -127,10 +127,10 @@ namespace Microsoft.OpenApi { bool AllowEmptyValue { get; } bool AllowReserved { get; } - System.Collections.Generic.Dictionary? Content { get; } + System.Collections.Generic.IDictionary? Content { get; } bool Deprecated { get; } System.Text.Json.Nodes.JsonNode? Example { get; } - System.Collections.Generic.Dictionary? Examples { get; } + System.Collections.Generic.IDictionary? Examples { get; } bool Explode { get; } Microsoft.OpenApi.ParameterLocation? In { get; } string? Name { get; } @@ -141,8 +141,8 @@ namespace Microsoft.OpenApi public interface IOpenApiPathItem : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IOpenApiSummarizedElement, Microsoft.OpenApi.IShallowCopyable { System.Collections.Generic.Dictionary? Operations { get; } - System.Collections.Generic.List? Parameters { get; } - System.Collections.Generic.List? Servers { get; } + System.Collections.Generic.IList? Parameters { get; } + System.Collections.Generic.IList? Servers { get; } } public interface IOpenApiReadOnlyDescribedElement : Microsoft.OpenApi.IOpenApiElement { @@ -150,7 +150,7 @@ namespace Microsoft.OpenApi } public interface IOpenApiReadOnlyExtensible { - System.Collections.Generic.Dictionary? Extensions { get; } + System.Collections.Generic.IDictionary? Extensions { get; } } public interface IOpenApiReader { @@ -174,35 +174,35 @@ namespace Microsoft.OpenApi public interface IOpenApiReferenceable : Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiSerializable { } public interface IOpenApiRequestBody : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { - System.Collections.Generic.Dictionary? Content { get; } + System.Collections.Generic.IDictionary? Content { get; } bool Required { get; } Microsoft.OpenApi.IOpenApiParameter? ConvertToBodyParameter(Microsoft.OpenApi.IOpenApiWriter writer); System.Collections.Generic.IEnumerable? ConvertToFormDataParameters(Microsoft.OpenApi.IOpenApiWriter writer); } public interface IOpenApiResponse : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { - System.Collections.Generic.Dictionary? Content { get; } - System.Collections.Generic.Dictionary? Headers { get; } - System.Collections.Generic.Dictionary? Links { get; } + System.Collections.Generic.IDictionary? Content { get; } + System.Collections.Generic.IDictionary? Headers { get; } + System.Collections.Generic.IDictionary? Links { get; } } public interface IOpenApiSchema : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { Microsoft.OpenApi.IOpenApiSchema? AdditionalProperties { get; } bool AdditionalPropertiesAllowed { get; } - System.Collections.Generic.List? AllOf { get; } - System.Collections.Generic.List? AnyOf { get; } + System.Collections.Generic.IList? AllOf { get; } + System.Collections.Generic.IList? AnyOf { get; } string? Comment { get; } string? Const { get; } System.Text.Json.Nodes.JsonNode? Default { get; } - System.Collections.Generic.Dictionary? Definitions { get; } - System.Collections.Generic.Dictionary>? DependentRequired { get; } + System.Collections.Generic.IDictionary? Definitions { get; } + System.Collections.Generic.IDictionary>? DependentRequired { get; } bool Deprecated { get; } Microsoft.OpenApi.OpenApiDiscriminator? Discriminator { get; } string? DynamicAnchor { get; } string? DynamicRef { get; } - System.Collections.Generic.List? Enum { get; } + System.Collections.Generic.IList? Enum { get; } System.Text.Json.Nodes.JsonNode? Example { get; } - System.Collections.Generic.List? Examples { get; } + System.Collections.Generic.IList? Examples { get; } string? ExclusiveMaximum { get; } string? ExclusiveMinimum { get; } Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; } @@ -219,19 +219,19 @@ namespace Microsoft.OpenApi string? Minimum { get; } decimal? MultipleOf { get; } Microsoft.OpenApi.IOpenApiSchema? Not { get; } - System.Collections.Generic.List? OneOf { get; } + System.Collections.Generic.IList? OneOf { get; } string? Pattern { get; } - System.Collections.Generic.Dictionary? PatternProperties { get; } - System.Collections.Generic.Dictionary? Properties { get; } + System.Collections.Generic.IDictionary? PatternProperties { get; } + System.Collections.Generic.IDictionary? Properties { get; } bool ReadOnly { get; } - System.Collections.Generic.HashSet? Required { get; } + System.Collections.Generic.ISet? Required { get; } System.Uri? Schema { get; } string? Title { get; } Microsoft.OpenApi.JsonSchemaType? Type { get; } bool UnevaluatedProperties { get; } bool? UniqueItems { get; } - System.Collections.Generic.Dictionary? UnrecognizedKeywords { get; } - System.Collections.Generic.Dictionary? Vocabulary { get; } + System.Collections.Generic.IDictionary? UnrecognizedKeywords { get; } + System.Collections.Generic.IDictionary? Vocabulary { get; } bool WriteOnly { get; } Microsoft.OpenApi.OpenApiXml? Xml { get; } } @@ -338,7 +338,7 @@ namespace Microsoft.OpenApi public class OpenApiCallback : Microsoft.OpenApi.IOpenApiCallback, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiCallback() { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Collections.Generic.Dictionary? PathItems { get; set; } public void AddPathItem(Microsoft.OpenApi.RuntimeExpression expression, Microsoft.OpenApi.IOpenApiPathItem pathItem) { } public Microsoft.OpenApi.IOpenApiCallback CreateShallowCopy() { } @@ -349,7 +349,7 @@ namespace Microsoft.OpenApi public class OpenApiCallbackReference : Microsoft.OpenApi.BaseOpenApiReferenceHolder, Microsoft.OpenApi.IOpenApiCallback, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiCallbackReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public System.Collections.Generic.Dictionary? PathItems { get; } public override Microsoft.OpenApi.IOpenApiCallback CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.IOpenApiCallback source) { } public Microsoft.OpenApi.IOpenApiCallback CreateShallowCopy() { } @@ -359,17 +359,17 @@ namespace Microsoft.OpenApi { public OpenApiComponents() { } public OpenApiComponents(Microsoft.OpenApi.OpenApiComponents? components) { } - public System.Collections.Generic.Dictionary? Callbacks { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Headers { get; set; } - public System.Collections.Generic.Dictionary? Links { get; set; } - public System.Collections.Generic.Dictionary? Parameters { get; set; } - public System.Collections.Generic.Dictionary? PathItems { get; set; } - public System.Collections.Generic.Dictionary? RequestBodies { get; set; } - public System.Collections.Generic.Dictionary? Responses { get; set; } - public System.Collections.Generic.Dictionary? Schemas { get; set; } - public System.Collections.Generic.Dictionary? SecuritySchemes { get; set; } + public System.Collections.Generic.IDictionary? Callbacks { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Headers { get; set; } + public System.Collections.Generic.IDictionary? Links { get; set; } + public System.Collections.Generic.IDictionary? Parameters { get; set; } + public System.Collections.Generic.IDictionary? PathItems { get; set; } + public System.Collections.Generic.IDictionary? RequestBodies { get; set; } + public System.Collections.Generic.IDictionary? Responses { get; set; } + public System.Collections.Generic.IDictionary? Schemas { get; set; } + public System.Collections.Generic.IDictionary? SecuritySchemes { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV31(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -542,7 +542,7 @@ namespace Microsoft.OpenApi public OpenApiContact() { } public OpenApiContact(Microsoft.OpenApi.OpenApiContact contact) { } public string? Email { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Name { get; set; } public System.Uri? Url { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -558,8 +558,8 @@ namespace Microsoft.OpenApi { public OpenApiDiscriminator() { } public OpenApiDiscriminator(Microsoft.OpenApi.OpenApiDiscriminator discriminator) { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Mapping { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Mapping { get; set; } public string? PropertyName { get; set; } public void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -571,16 +571,16 @@ namespace Microsoft.OpenApi public OpenApiDocument(Microsoft.OpenApi.OpenApiDocument? document) { } public System.Uri BaseUri { get; } public Microsoft.OpenApi.OpenApiComponents? Components { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; set; } public Microsoft.OpenApi.OpenApiInfo Info { get; set; } public System.Uri? JsonSchemaDialect { get; set; } - public System.Collections.Generic.Dictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } public Microsoft.OpenApi.OpenApiPaths Paths { get; set; } - public System.Collections.Generic.List? Security { get; set; } - public System.Collections.Generic.List? Servers { get; set; } - public System.Collections.Generic.HashSet? Tags { get; set; } - public System.Collections.Generic.Dictionary? Webhooks { get; set; } + public System.Collections.Generic.IList? Security { get; set; } + public System.Collections.Generic.IList? Servers { get; set; } + public System.Collections.Generic.ISet? Tags { get; set; } + public System.Collections.Generic.IDictionary? Webhooks { get; set; } public Microsoft.OpenApi.OpenApiWorkspace? Workspace { get; set; } public bool AddComponent(string id, T componentToRegister) { } public System.Threading.Tasks.Task GetHashCodeAsync(System.Threading.CancellationToken cancellationToken = default) { } @@ -611,8 +611,8 @@ namespace Microsoft.OpenApi public bool? AllowReserved { get; set; } public string? ContentType { get; set; } public bool? Explode { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Headers { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Headers { get; set; } public Microsoft.OpenApi.ParameterStyle? Style { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -631,7 +631,7 @@ namespace Microsoft.OpenApi { public OpenApiExample() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? ExternalValue { get; set; } public string? Summary { get; set; } public System.Text.Json.Nodes.JsonNode? Value { get; set; } @@ -644,7 +644,7 @@ namespace Microsoft.OpenApi { public OpenApiExampleReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public string? ExternalValue { get; } public string? Summary { get; set; } public System.Text.Json.Nodes.JsonNode? Value { get; } @@ -664,7 +664,7 @@ namespace Microsoft.OpenApi { protected OpenApiExtensibleDictionary() { } protected OpenApiExtensibleDictionary(System.Collections.Generic.Dictionary dictionary, System.Collections.Generic.Dictionary? extensions = null) { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV31(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -684,7 +684,7 @@ namespace Microsoft.OpenApi public OpenApiExternalDocs() { } public OpenApiExternalDocs(Microsoft.OpenApi.OpenApiExternalDocs externalDocs) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Uri? Url { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -706,13 +706,13 @@ namespace Microsoft.OpenApi public OpenApiHeader() { } public bool AllowEmptyValue { get; set; } public bool AllowReserved { get; set; } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } public bool Explode { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public bool Required { get; set; } public Microsoft.OpenApi.IOpenApiSchema? Schema { get; set; } public Microsoft.OpenApi.ParameterStyle? Style { get; set; } @@ -726,13 +726,13 @@ namespace Microsoft.OpenApi public OpenApiHeaderReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public bool AllowEmptyValue { get; } public bool AllowReserved { get; } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public bool Deprecated { get; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; } - public System.Collections.Generic.Dictionary? Examples { get; } + public System.Collections.Generic.IDictionary? Examples { get; } public bool Explode { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public bool Required { get; } public Microsoft.OpenApi.IOpenApiSchema? Schema { get; } public Microsoft.OpenApi.ParameterStyle? Style { get; } @@ -745,7 +745,7 @@ namespace Microsoft.OpenApi public OpenApiInfo(Microsoft.OpenApi.OpenApiInfo info) { } public Microsoft.OpenApi.OpenApiContact? Contact { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiLicense? License { get; set; } public string? Summary { get; set; } public System.Uri? TermsOfService { get; set; } @@ -786,7 +786,7 @@ namespace Microsoft.OpenApi { public OpenApiLicense() { } public OpenApiLicense(Microsoft.OpenApi.OpenApiLicense license) { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Identifier { get; set; } public string? Name { get; set; } public System.Uri? Url { get; set; } @@ -803,10 +803,10 @@ namespace Microsoft.OpenApi { public OpenApiLink() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? OperationId { get; set; } public string? OperationRef { get; set; } - public System.Collections.Generic.Dictionary? Parameters { get; set; } + public System.Collections.Generic.IDictionary? Parameters { get; set; } public Microsoft.OpenApi.RuntimeExpressionAnyWrapper? RequestBody { get; set; } public Microsoft.OpenApi.OpenApiServer? Server { get; set; } public Microsoft.OpenApi.IOpenApiLink CreateShallowCopy() { } @@ -818,10 +818,10 @@ namespace Microsoft.OpenApi { public OpenApiLinkReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public string? OperationId { get; } public string? OperationRef { get; } - public System.Collections.Generic.Dictionary? Parameters { get; } + public System.Collections.Generic.IDictionary? Parameters { get; } public Microsoft.OpenApi.RuntimeExpressionAnyWrapper? RequestBody { get; } public Microsoft.OpenApi.OpenApiServer? Server { get; } public override Microsoft.OpenApi.IOpenApiLink CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.IOpenApiLink source) { } @@ -832,10 +832,10 @@ namespace Microsoft.OpenApi { public OpenApiMediaType() { } public OpenApiMediaType(Microsoft.OpenApi.OpenApiMediaType? mediaType) { } - public System.Collections.Generic.Dictionary? Encoding { get; set; } + public System.Collections.Generic.IDictionary? Encoding { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.IOpenApiSchema? Schema { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -853,9 +853,9 @@ namespace Microsoft.OpenApi public OpenApiOAuthFlow() { } public OpenApiOAuthFlow(Microsoft.OpenApi.OpenApiOAuthFlow oAuthFlow) { } public System.Uri? AuthorizationUrl { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Uri? RefreshUrl { get; set; } - public System.Collections.Generic.Dictionary? Scopes { get; set; } + public System.Collections.Generic.IDictionary? Scopes { get; set; } public System.Uri? TokenUrl { get; set; } public void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -872,7 +872,7 @@ namespace Microsoft.OpenApi public OpenApiOAuthFlows(Microsoft.OpenApi.OpenApiOAuthFlows oAuthFlows) { } public Microsoft.OpenApi.OpenApiOAuthFlow? AuthorizationCode { get; set; } public Microsoft.OpenApi.OpenApiOAuthFlow? ClientCredentials { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiOAuthFlow? Implicit { get; set; } public Microsoft.OpenApi.OpenApiOAuthFlow? Password { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -884,20 +884,20 @@ namespace Microsoft.OpenApi public const bool DeprecatedDefault = false; public OpenApiOperation() { } public OpenApiOperation(Microsoft.OpenApi.OpenApiOperation operation) { } - public System.Collections.Generic.Dictionary? Callbacks { get; set; } + public System.Collections.Generic.IDictionary? Callbacks { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; set; } - public System.Collections.Generic.Dictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } public string? OperationId { get; set; } - public System.Collections.Generic.List? Parameters { get; set; } + public System.Collections.Generic.IList? Parameters { get; set; } public Microsoft.OpenApi.IOpenApiRequestBody? RequestBody { get; set; } public Microsoft.OpenApi.OpenApiResponses? Responses { get; set; } - public System.Collections.Generic.List? Security { get; set; } - public System.Collections.Generic.List? Servers { get; set; } + public System.Collections.Generic.IList? Security { get; set; } + public System.Collections.Generic.IList? Servers { get; set; } public string? Summary { get; set; } - public System.Collections.Generic.HashSet? Tags { get; set; } + public System.Collections.Generic.ISet? Tags { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV31(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -907,13 +907,13 @@ namespace Microsoft.OpenApi public OpenApiParameter() { } public bool AllowEmptyValue { get; set; } public bool AllowReserved { get; set; } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } public bool Explode { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.ParameterLocation? In { get; set; } public string? Name { get; set; } public bool Required { get; set; } @@ -929,13 +929,13 @@ namespace Microsoft.OpenApi public OpenApiParameterReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public bool AllowEmptyValue { get; } public bool AllowReserved { get; } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public bool Deprecated { get; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; } - public System.Collections.Generic.Dictionary? Examples { get; } + public System.Collections.Generic.IDictionary? Examples { get; } public bool Explode { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.ParameterLocation? In { get; } public string? Name { get; } public bool Required { get; } @@ -955,10 +955,10 @@ namespace Microsoft.OpenApi { public OpenApiPathItem() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Collections.Generic.Dictionary? Operations { get; set; } - public System.Collections.Generic.List? Parameters { get; set; } - public System.Collections.Generic.List? Servers { get; set; } + public System.Collections.Generic.IList? Parameters { get; set; } + public System.Collections.Generic.IList? Servers { get; set; } public string? Summary { get; set; } public void AddOperation(System.Net.Http.HttpMethod operationType, Microsoft.OpenApi.OpenApiOperation operation) { } public Microsoft.OpenApi.IOpenApiPathItem CreateShallowCopy() { } @@ -970,10 +970,10 @@ namespace Microsoft.OpenApi { public OpenApiPathItemReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public System.Collections.Generic.Dictionary? Operations { get; } - public System.Collections.Generic.List? Parameters { get; } - public System.Collections.Generic.List? Servers { get; } + public System.Collections.Generic.IList? Parameters { get; } + public System.Collections.Generic.IList? Servers { get; } public string? Summary { get; set; } public override Microsoft.OpenApi.IOpenApiPathItem CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.IOpenApiPathItem source) { } public Microsoft.OpenApi.IOpenApiPathItem CreateShallowCopy() { } @@ -1030,9 +1030,9 @@ namespace Microsoft.OpenApi public class OpenApiRequestBody : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiRequestBody, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiRequestBody() { } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public bool Required { get; set; } public Microsoft.OpenApi.IOpenApiParameter ConvertToBodyParameter(Microsoft.OpenApi.IOpenApiWriter writer) { } public System.Collections.Generic.IEnumerable ConvertToFormDataParameters(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -1044,9 +1044,9 @@ namespace Microsoft.OpenApi public class OpenApiRequestBodyReference : Microsoft.OpenApi.BaseOpenApiReferenceHolder, Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiRequestBody, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiRequestBodyReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public bool Required { get; } public Microsoft.OpenApi.IOpenApiParameter? ConvertToBodyParameter(Microsoft.OpenApi.IOpenApiWriter writer) { } public System.Collections.Generic.IEnumerable? ConvertToFormDataParameters(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -1057,11 +1057,11 @@ namespace Microsoft.OpenApi public class OpenApiResponse : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiResponse, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiResponse() { } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Headers { get; set; } - public System.Collections.Generic.Dictionary? Links { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Headers { get; set; } + public System.Collections.Generic.IDictionary? Links { get; set; } public Microsoft.OpenApi.IOpenApiResponse CreateShallowCopy() { } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -1070,11 +1070,11 @@ namespace Microsoft.OpenApi public class OpenApiResponseReference : Microsoft.OpenApi.BaseOpenApiReferenceHolder, Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiResponse, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiResponseReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } - public System.Collections.Generic.Dictionary? Headers { get; } - public System.Collections.Generic.Dictionary? Links { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Headers { get; } + public System.Collections.Generic.IDictionary? Links { get; } public override Microsoft.OpenApi.IOpenApiResponse CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.IOpenApiResponse source) { } public Microsoft.OpenApi.IOpenApiResponse CreateShallowCopy() { } } @@ -1104,24 +1104,24 @@ namespace Microsoft.OpenApi public OpenApiSchema() { } public Microsoft.OpenApi.IOpenApiSchema? AdditionalProperties { get; set; } public bool AdditionalPropertiesAllowed { get; set; } - public System.Collections.Generic.List? AllOf { get; set; } - public System.Collections.Generic.List? AnyOf { get; set; } + public System.Collections.Generic.IList? AllOf { get; set; } + public System.Collections.Generic.IList? AnyOf { get; set; } public string? Comment { get; set; } public string? Const { get; set; } public System.Text.Json.Nodes.JsonNode? Default { get; set; } - public System.Collections.Generic.Dictionary? Definitions { get; set; } - public System.Collections.Generic.Dictionary>? DependentRequired { get; set; } + public System.Collections.Generic.IDictionary? Definitions { get; set; } + public System.Collections.Generic.IDictionary>? DependentRequired { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } public Microsoft.OpenApi.OpenApiDiscriminator? Discriminator { get; set; } public string? DynamicAnchor { get; set; } public string? DynamicRef { get; set; } - public System.Collections.Generic.List? Enum { get; set; } + public System.Collections.Generic.IList? Enum { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.List? Examples { get; set; } + public System.Collections.Generic.IList? Examples { get; set; } public string? ExclusiveMaximum { get; set; } public string? ExclusiveMinimum { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; set; } public string? Format { get; set; } public string? Id { get; set; } @@ -1130,26 +1130,26 @@ namespace Microsoft.OpenApi public int? MaxLength { get; set; } public int? MaxProperties { get; set; } public string? Maximum { get; set; } - public System.Collections.Generic.Dictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } public int? MinItems { get; set; } public int? MinLength { get; set; } public int? MinProperties { get; set; } public string? Minimum { get; set; } public decimal? MultipleOf { get; set; } public Microsoft.OpenApi.IOpenApiSchema? Not { get; set; } - public System.Collections.Generic.List? OneOf { get; set; } + public System.Collections.Generic.IList? OneOf { get; set; } public string? Pattern { get; set; } - public System.Collections.Generic.Dictionary? PatternProperties { get; set; } - public System.Collections.Generic.Dictionary? Properties { get; set; } + public System.Collections.Generic.IDictionary? PatternProperties { get; set; } + public System.Collections.Generic.IDictionary? Properties { get; set; } public bool ReadOnly { get; set; } - public System.Collections.Generic.HashSet? Required { get; set; } + public System.Collections.Generic.ISet? Required { get; set; } public System.Uri? Schema { get; set; } public string? Title { get; set; } public Microsoft.OpenApi.JsonSchemaType? Type { get; set; } public bool UnevaluatedProperties { get; set; } public bool? UniqueItems { get; set; } - public System.Collections.Generic.Dictionary? UnrecognizedKeywords { get; set; } - public System.Collections.Generic.Dictionary? Vocabulary { get; set; } + public System.Collections.Generic.IDictionary? UnrecognizedKeywords { get; set; } + public System.Collections.Generic.IDictionary? Vocabulary { get; set; } public bool WriteOnly { get; set; } public Microsoft.OpenApi.OpenApiXml? Xml { get; set; } public Microsoft.OpenApi.IOpenApiSchema CreateShallowCopy() { } @@ -1162,24 +1162,24 @@ namespace Microsoft.OpenApi public OpenApiSchemaReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public Microsoft.OpenApi.IOpenApiSchema? AdditionalProperties { get; } public bool AdditionalPropertiesAllowed { get; } - public System.Collections.Generic.List? AllOf { get; } - public System.Collections.Generic.List? AnyOf { get; } + public System.Collections.Generic.IList? AllOf { get; } + public System.Collections.Generic.IList? AnyOf { get; } public string? Comment { get; } public string? Const { get; } public System.Text.Json.Nodes.JsonNode? Default { get; } - public System.Collections.Generic.Dictionary? Definitions { get; } - public System.Collections.Generic.Dictionary>? DependentRequired { get; } + public System.Collections.Generic.IDictionary? Definitions { get; } + public System.Collections.Generic.IDictionary>? DependentRequired { get; } public bool Deprecated { get; } public string? Description { get; set; } public Microsoft.OpenApi.OpenApiDiscriminator? Discriminator { get; } public string? DynamicAnchor { get; } public string? DynamicRef { get; } - public System.Collections.Generic.List? Enum { get; } + public System.Collections.Generic.IList? Enum { get; } public System.Text.Json.Nodes.JsonNode? Example { get; } - public System.Collections.Generic.List? Examples { get; } + public System.Collections.Generic.IList? Examples { get; } public string? ExclusiveMaximum { get; } public string? ExclusiveMinimum { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; } public string? Format { get; } public string? Id { get; } @@ -1194,19 +1194,19 @@ namespace Microsoft.OpenApi public string? Minimum { get; } public decimal? MultipleOf { get; } public Microsoft.OpenApi.IOpenApiSchema? Not { get; } - public System.Collections.Generic.List? OneOf { get; } + public System.Collections.Generic.IList? OneOf { get; } public string? Pattern { get; } - public System.Collections.Generic.Dictionary? PatternProperties { get; } - public System.Collections.Generic.Dictionary? Properties { get; } + public System.Collections.Generic.IDictionary? PatternProperties { get; } + public System.Collections.Generic.IDictionary? Properties { get; } public bool ReadOnly { get; } - public System.Collections.Generic.HashSet? Required { get; } + public System.Collections.Generic.ISet? Required { get; } public System.Uri? Schema { get; } public string? Title { get; } public Microsoft.OpenApi.JsonSchemaType? Type { get; } public bool UnevaluatedProperties { get; } public bool? UniqueItems { get; } - public System.Collections.Generic.Dictionary? UnrecognizedKeywords { get; } - public System.Collections.Generic.Dictionary? Vocabulary { get; } + public System.Collections.Generic.IDictionary? UnrecognizedKeywords { get; } + public System.Collections.Generic.IDictionary? Vocabulary { get; } public bool WriteOnly { get; } public Microsoft.OpenApi.OpenApiXml? Xml { get; } public override Microsoft.OpenApi.IOpenApiSchema CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.IOpenApiSchema source) { } @@ -1219,7 +1219,7 @@ namespace Microsoft.OpenApi public static class OpenApiSchemaRules { public static Microsoft.OpenApi.ValidationRule ValidateSchemaDiscriminator { get; } - public static bool TraverseSchemaElements(string discriminatorName, System.Collections.Generic.List? childSchema) { } + public static bool TraverseSchemaElements(string discriminatorName, System.Collections.Generic.IList? childSchema) { } public static bool ValidateChildSchemaAgainstDiscriminator(Microsoft.OpenApi.IOpenApiSchema schema, string? discriminatorName) { } } public class OpenApiSecurityRequirement : System.Collections.Generic.Dictionary>, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiSerializable @@ -1234,7 +1234,7 @@ namespace Microsoft.OpenApi public OpenApiSecurityScheme() { } public string? BearerFormat { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiOAuthFlows? Flows { get; set; } public Microsoft.OpenApi.ParameterLocation? In { get; set; } public string? Name { get; set; } @@ -1251,7 +1251,7 @@ namespace Microsoft.OpenApi public OpenApiSecuritySchemeReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? BearerFormat { get; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.OpenApiOAuthFlows? Flows { get; } public Microsoft.OpenApi.ParameterLocation? In { get; } public string? Name { get; } @@ -1285,9 +1285,9 @@ namespace Microsoft.OpenApi public OpenApiServer() { } public OpenApiServer(Microsoft.OpenApi.OpenApiServer server) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Url { get; set; } - public System.Collections.Generic.Dictionary? Variables { get; set; } + public System.Collections.Generic.IDictionary? Variables { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV31(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -1308,7 +1308,7 @@ namespace Microsoft.OpenApi public string? Default { get; set; } public string? Description { get; set; } public System.Collections.Generic.List? Enum { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV31(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -1323,7 +1323,7 @@ namespace Microsoft.OpenApi { public OpenApiTag() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; set; } public string? Name { get; set; } public Microsoft.OpenApi.IOpenApiTag CreateShallowCopy() { } @@ -1335,7 +1335,7 @@ namespace Microsoft.OpenApi { public OpenApiTagReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; } public string? Name { get; } public override Microsoft.OpenApi.IOpenApiTag? Target { get; } @@ -1366,11 +1366,11 @@ namespace Microsoft.OpenApi public class OpenApiUrlTreeNode { public static readonly System.Collections.Generic.IReadOnlyDictionary MermaidNodeStyles; - public System.Collections.Generic.Dictionary> AdditionalData { get; set; } - public System.Collections.Generic.Dictionary Children { get; } + public System.Collections.Generic.IDictionary> AdditionalData { get; set; } + public System.Collections.Generic.IDictionary Children { get; } public bool IsParameter { get; } public string Path { get; set; } - public System.Collections.Generic.Dictionary PathItems { get; } + public System.Collections.Generic.IDictionary PathItems { get; } public string Segment { get; } public void AddAdditionalData(System.Collections.Generic.Dictionary> additionalData) { } public void Attach(Microsoft.OpenApi.OpenApiDocument doc, string label) { } @@ -1415,14 +1415,14 @@ namespace Microsoft.OpenApi public override void Visit(Microsoft.OpenApi.OpenApiServer server) { } public override void Visit(Microsoft.OpenApi.OpenApiServerVariable serverVariable) { } public override void Visit(Microsoft.OpenApi.OpenApiTag tag) { } - public override void Visit(System.Collections.Generic.Dictionary operations) { } - public override void Visit(System.Collections.Generic.Dictionary callbacks) { } - public override void Visit(System.Collections.Generic.Dictionary examples) { } - public override void Visit(System.Collections.Generic.Dictionary headers) { } - public override void Visit(System.Collections.Generic.Dictionary links) { } - public override void Visit(System.Collections.Generic.Dictionary encodings) { } - public override void Visit(System.Collections.Generic.Dictionary content) { } - public override void Visit(System.Collections.Generic.Dictionary serverVariables) { } + public override void Visit(System.Collections.Generic.IDictionary operations) { } + public override void Visit(System.Collections.Generic.IDictionary callbacks) { } + public override void Visit(System.Collections.Generic.IDictionary examples) { } + public override void Visit(System.Collections.Generic.IDictionary headers) { } + public override void Visit(System.Collections.Generic.IDictionary links) { } + public override void Visit(System.Collections.Generic.IDictionary encodings) { } + public override void Visit(System.Collections.Generic.IDictionary content) { } + public override void Visit(System.Collections.Generic.IDictionary serverVariables) { } public override void Visit(System.Collections.Generic.List example) { } } public class OpenApiValidatorError : Microsoft.OpenApi.OpenApiError @@ -1472,21 +1472,21 @@ namespace Microsoft.OpenApi public virtual void Visit(Microsoft.OpenApi.OpenApiServerVariable serverVariable) { } public virtual void Visit(Microsoft.OpenApi.OpenApiTag tag) { } public virtual void Visit(Microsoft.OpenApi.OpenApiTagReference tag) { } - public virtual void Visit(System.Collections.Generic.Dictionary operations) { } - public virtual void Visit(System.Collections.Generic.Dictionary callbacks) { } - public virtual void Visit(System.Collections.Generic.Dictionary examples) { } - public virtual void Visit(System.Collections.Generic.Dictionary headers) { } - public virtual void Visit(System.Collections.Generic.Dictionary links) { } - public virtual void Visit(System.Collections.Generic.Dictionary webhooks) { } - public virtual void Visit(System.Collections.Generic.Dictionary encodings) { } - public virtual void Visit(System.Collections.Generic.Dictionary content) { } - public virtual void Visit(System.Collections.Generic.Dictionary serverVariables) { } - public virtual void Visit(System.Collections.Generic.HashSet openApiTags) { } - public virtual void Visit(System.Collections.Generic.HashSet openApiTags) { } + public virtual void Visit(System.Collections.Generic.IDictionary operations) { } + public virtual void Visit(System.Collections.Generic.IDictionary callbacks) { } + public virtual void Visit(System.Collections.Generic.IDictionary examples) { } + public virtual void Visit(System.Collections.Generic.IDictionary headers) { } + public virtual void Visit(System.Collections.Generic.IDictionary links) { } + public virtual void Visit(System.Collections.Generic.IDictionary webhooks) { } + public virtual void Visit(System.Collections.Generic.IDictionary encodings) { } + public virtual void Visit(System.Collections.Generic.IDictionary content) { } + public virtual void Visit(System.Collections.Generic.IDictionary serverVariables) { } + public virtual void Visit(System.Collections.Generic.IList parameters) { } + public virtual void Visit(System.Collections.Generic.IList openApiSecurityRequirements) { } + public virtual void Visit(System.Collections.Generic.IList servers) { } + public virtual void Visit(System.Collections.Generic.ISet openApiTags) { } + public virtual void Visit(System.Collections.Generic.ISet openApiTags) { } public virtual void Visit(System.Collections.Generic.List example) { } - public virtual void Visit(System.Collections.Generic.List parameters) { } - public virtual void Visit(System.Collections.Generic.List openApiSecurityRequirements) { } - public virtual void Visit(System.Collections.Generic.List servers) { } public virtual void Visit(System.Text.Json.Nodes.JsonNode node) { } } public class OpenApiWalker @@ -1511,7 +1511,7 @@ namespace Microsoft.OpenApi public static class OpenApiWriterAnyExtensions { public static void WriteAny(this Microsoft.OpenApi.IOpenApiWriter writer, System.Text.Json.Nodes.JsonNode? node) { } - public static void WriteExtensions(this Microsoft.OpenApi.IOpenApiWriter writer, System.Collections.Generic.Dictionary? extensions, Microsoft.OpenApi.OpenApiSpecVersion specVersion) { } + public static void WriteExtensions(this Microsoft.OpenApi.IOpenApiWriter writer, System.Collections.Generic.IDictionary? extensions, Microsoft.OpenApi.OpenApiSpecVersion specVersion) { } } public abstract class OpenApiWriterBase : Microsoft.OpenApi.IOpenApiWriter { @@ -1564,13 +1564,13 @@ namespace Microsoft.OpenApi { public static void WriteOptionalCollection(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable? elements, System.Action action) { } public static void WriteOptionalCollection(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary>? elements, System.Action> action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary>? elements, System.Action> action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) where T : Microsoft.OpenApi.IOpenApiElement { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) where T : Microsoft.OpenApi.IOpenApiElement { } public static void WriteOptionalObject(this Microsoft.OpenApi.IOpenApiWriter writer, string name, T? value, System.Action action) { } public static void WriteOptionalOrEmptyCollection(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable? elements, System.Action action) { } @@ -1583,8 +1583,8 @@ namespace Microsoft.OpenApi where T : struct { } public static void WriteRequiredCollection(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable elements, System.Action action) where T : Microsoft.OpenApi.IOpenApiElement { } - public static void WriteRequiredMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteRequiredMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) + public static void WriteRequiredMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteRequiredMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) where T : Microsoft.OpenApi.IOpenApiElement { } public static void WriteRequiredObject(this Microsoft.OpenApi.IOpenApiWriter writer, string name, T? value, System.Action action) { } public static void WriteRequiredProperty(this Microsoft.OpenApi.IOpenApiWriter writer, string name, string? value) { } @@ -1594,13 +1594,14 @@ namespace Microsoft.OpenApi public OpenApiWriterSettings() { } public bool InlineExternalReferences { get; set; } public bool InlineLocalReferences { get; set; } + public System.Collections.Generic.IComparer? KeyComparer { get; set; } } public class OpenApiXml : Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IOpenApiSerializable { public OpenApiXml() { } public OpenApiXml(Microsoft.OpenApi.OpenApiXml xml) { } public bool Attribute { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Name { get; set; } public System.Uri? Namespace { get; set; } public string? Prefix { get; set; } @@ -1628,9 +1629,9 @@ namespace Microsoft.OpenApi public class OperationSearch : Microsoft.OpenApi.OpenApiVisitorBase { public OperationSearch(System.Func predicate) { } - public System.Collections.Generic.List SearchResults { get; } + public System.Collections.Generic.IList SearchResults { get; } public override void Visit(Microsoft.OpenApi.IOpenApiPathItem pathItem) { } - public override void Visit(System.Collections.Generic.List parameters) { } + public override void Visit(System.Collections.Generic.IList parameters) { } } public enum ParameterLocation { @@ -1749,7 +1750,7 @@ namespace Microsoft.OpenApi public SearchResult() { } public Microsoft.OpenApi.CurrentKeys? CurrentKeys { get; set; } public Microsoft.OpenApi.OpenApiOperation? Operation { get; set; } - public System.Collections.Generic.List? Parameters { get; set; } + public System.Collections.Generic.IList? Parameters { get; set; } } public enum SecuritySchemeType { @@ -1796,13 +1797,13 @@ namespace Microsoft.OpenApi public ValidationRuleSet(Microsoft.OpenApi.ValidationRuleSet ruleSet) { } public ValidationRuleSet(System.Collections.Generic.Dictionary> rules) { } public int Count { get; } - public System.Collections.Generic.List Rules { get; } + public System.Collections.Generic.IList Rules { get; } public void Add(System.Type key, Microsoft.OpenApi.ValidationRule rule) { } public void Add(System.Type key, System.Collections.Generic.List rules) { } public void Clear() { } public bool Contains(System.Type key, Microsoft.OpenApi.ValidationRule rule) { } public bool ContainsKey(System.Type key) { } - public System.Collections.Generic.List FindRules(System.Type type) { } + public System.Collections.Generic.IList FindRules(System.Type type) { } public System.Collections.Generic.IEnumerator GetEnumerator() { } public bool Remove(Microsoft.OpenApi.ValidationRule rule) { } public bool Remove(System.Type key) { } @@ -1898,9 +1899,9 @@ namespace Microsoft.OpenApi.Reader public class OpenApiDiagnostic : Microsoft.OpenApi.IDiagnostic { public OpenApiDiagnostic() { } - public System.Collections.Generic.List Errors { get; set; } + public System.Collections.Generic.IList Errors { get; set; } public Microsoft.OpenApi.OpenApiSpecVersion SpecificationVersion { get; set; } - public System.Collections.Generic.List Warnings { get; set; } + public System.Collections.Generic.IList Warnings { get; set; } public void AppendDiagnostic(Microsoft.OpenApi.Reader.OpenApiDiagnostic diagnosticToAdd, string? fileNameToAdd = null) { } } public class OpenApiJsonReader : Microsoft.OpenApi.IOpenApiReader diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs index fe74c51f8..bcf11ac3d 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs @@ -24,7 +24,7 @@ public void ReferencedSchemaShouldOnlyBeValidatedOnce() var document = new OpenApiDocument(); document.Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["test"] = sharedSchema } @@ -42,7 +42,7 @@ public void ReferencedSchemaShouldOnlyBeValidatedOnce() { ["200"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -96,7 +96,7 @@ public void UnresolvedSchemaReferencedShouldNotBeValidated() { ["200"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { diff --git a/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs b/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs index 1eec4de33..25f917c9d 100644 --- a/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs @@ -108,7 +108,7 @@ public override void Visit(OpenApiLicense license) base.Visit(license); } - public override void Visit(List servers) + public override void Visit(IList servers) { EncodeCall(); base.Visit(servers); @@ -138,7 +138,7 @@ public override void Visit(OpenApiServerVariable serverVariable) base.Visit(serverVariable); } - public override void Visit(Dictionary operations) + public override void Visit(IDictionary operations) { EncodeCall(); base.Visit(operations); @@ -150,7 +150,7 @@ public override void Visit(OpenApiOperation operation) base.Visit(operation); } - public override void Visit(List parameters) + public override void Visit(IList parameters) { EncodeCall(); base.Visit(parameters); @@ -168,13 +168,13 @@ public override void Visit(IOpenApiRequestBody requestBody) base.Visit(requestBody); } - public override void Visit(Dictionary headers) + public override void Visit(IDictionary headers) { EncodeCall(); base.Visit(headers); } - public override void Visit(Dictionary callbacks) + public override void Visit(IDictionary callbacks) { EncodeCall(); base.Visit(callbacks); @@ -192,7 +192,7 @@ public override void Visit(OpenApiResponses response) base.Visit(response); } - public override void Visit(Dictionary content) + public override void Visit(IDictionary content) { EncodeCall(); base.Visit(content); @@ -210,7 +210,7 @@ public override void Visit(OpenApiEncoding encoding) base.Visit(encoding); } - public override void Visit(Dictionary examples) + public override void Visit(IDictionary examples) { EncodeCall(); base.Visit(examples); @@ -234,7 +234,7 @@ public override void Visit(IOpenApiSchema schema) base.Visit(schema); } - public override void Visit(Dictionary links) + public override void Visit(IDictionary links) { EncodeCall(); base.Visit(links); @@ -288,13 +288,13 @@ public override void Visit(IOpenApiExample example) base.Visit(example); } - public override void Visit(HashSet openApiTags) + public override void Visit(ISet openApiTags) { EncodeCall(); base.Visit(openApiTags); } - public override void Visit(List openApiSecurityRequirements) + public override void Visit(IList openApiSecurityRequirements) { EncodeCall(); base.Visit(openApiSecurityRequirements); @@ -318,13 +318,13 @@ public override void Visit(List example) base.Visit(example); } - public override void Visit(Dictionary serverVariables) + public override void Visit(IDictionary serverVariables) { EncodeCall(); base.Visit(serverVariables); } - public override void Visit(Dictionary encodings) + public override void Visit(IDictionary encodings) { EncodeCall(); base.Visit(encodings); diff --git a/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs b/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs index eea3510cc..60ea86e4a 100644 --- a/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs @@ -71,7 +71,7 @@ public void LocatePathOperationContentSchema() { ["200"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -114,7 +114,7 @@ public void WalkDOMWithCycles() var loopySchema = new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { Type = JsonSchemaType.String } } @@ -126,7 +126,7 @@ public void WalkDOMWithCycles() { Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["loopy"] = loopySchema } @@ -156,7 +156,7 @@ public void LocateReferences() var baseSchema = new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["type"] = new OpenApiSchema() { Type = JsonSchemaType.String } }, @@ -196,7 +196,7 @@ public void LocateReferences() { ["200"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -215,7 +215,7 @@ public void LocateReferences() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["derived"] = derivedSchema, ["base"] = baseSchema, @@ -297,7 +297,7 @@ public override void Visit(IOpenApiReferenceHolder referenceable) { Locations.Add("referenceAt: " + this.PathString); } - public override void Visit(Dictionary content) + public override void Visit(IDictionary content) { Locations.Add(this.PathString); } @@ -313,12 +313,12 @@ public override void Visit(IOpenApiSchema schema) Locations.Add(this.PathString); } - public override void Visit(HashSet openApiTags) + public override void Visit(ISet openApiTags) { Locations.Add(this.PathString); } - public override void Visit(List servers) + public override void Visit(IList servers) { Locations.Add(this.PathString); } @@ -327,7 +327,7 @@ public override void Visit(OpenApiServer server) { Locations.Add(this.PathString); } - public override void Visit(HashSet openApiTags) + public override void Visit(ISet openApiTags) { Locations.Add(this.PathString); } diff --git a/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs b/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs index b9eed62d3..a9bb9979f 100644 --- a/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs @@ -32,7 +32,7 @@ public void OpenApiWorkspacesCanAddComponentsFromAnotherDocument() { ["200"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType() { @@ -51,7 +51,7 @@ public void OpenApiWorkspacesCanAddComponentsFromAnotherDocument() { Components = new OpenApiComponents() { - Schemas = new() + Schemas = new Dictionary() { ["test"] = testSchema } @@ -127,7 +127,7 @@ private static OpenApiDocument CreateCommonDocument() { Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["test"] = new OpenApiSchema() { diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs b/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs index 93f873df1..5cf55ffe9 100644 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs @@ -461,7 +461,7 @@ private static OpenApiDocument CreateDocWithSimpleSchemaToInline() ["200"] = new OpenApiResponse() { Description = "OK", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -476,7 +476,7 @@ private static OpenApiDocument CreateDocWithSimpleSchemaToInline() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["thing"] = thingSchema }