Skip to content

Commit e207248

Browse files
authored
BREAKING CHANGE!: Use Microsoft OpenAPI document instead of own model (#1)
* Move to Microsoft impl * fix: Rewrite to MS model * fix: Move loading api * fix: Fix source generator * fix: Update headers * fix: Update client * fix: Run the CLI tests
1 parent cafd2d2 commit e207248

File tree

116 files changed

+107042
-4390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+107042
-4390
lines changed

.config/dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"csharpier": {
6+
"version": "1.0.3",
7+
"commands": [
8+
"csharpier"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

.csharpierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"printWidth": 110,
3+
"useTabs": false,
4+
"tabWidth": 4,
5+
"preprocessorSymbolSets": [
6+
"",
7+
"DEBUG",
8+
"DEBUG,CODE_STYLE"
9+
]
10+
}

.editorconfig

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,25 @@ indent_size = 4
1515
indent_style = space
1616

1717
# New line preferences
18-
end_of_line = unset
18+
end_of_line = crlf
1919
insert_final_newline = false
20+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
21+
dotnet_style_coalesce_expression = true:suggestion
22+
dotnet_style_null_propagation = true:suggestion
23+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
24+
dotnet_style_prefer_auto_properties = true:silent
25+
dotnet_style_object_initializer = true:suggestion
26+
dotnet_style_collection_initializer = true:suggestion
27+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
28+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
29+
dotnet_style_prefer_conditional_expression_over_return = true:silent
30+
dotnet_style_explicit_tuple_names = true:suggestion
31+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
32+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
33+
dotnet_style_prefer_compound_assignment = true:suggestion
34+
dotnet_style_prefer_simplified_interpolation = true:suggestion
35+
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
36+
dotnet_style_namespace_match_folder = true:suggestion
2037

2138
#### Build files ####
2239

@@ -50,10 +67,10 @@ file_header_template = This Source Code Form is subject to the terms of the MIT
5067
#### .NET Coding Conventions ####
5168

5269
# this. and Me. preferences
53-
dotnet_style_qualification_for_event = false:warning
54-
dotnet_style_qualification_for_field = true:warning
55-
dotnet_style_qualification_for_method = false:warning
56-
dotnet_style_qualification_for_property = false:warning
70+
dotnet_style_qualification_for_event = false:none
71+
dotnet_style_qualification_for_field = false:none
72+
dotnet_style_qualification_for_method = false:none
73+
dotnet_style_qualification_for_property = false:none
5774

5875
# Language keywords vs BCL types preferences
5976
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
@@ -99,13 +116,13 @@ csharp_style_var_for_built_in_types = false:warning
99116
csharp_style_var_when_type_is_apparent = false:warning
100117

101118
# Expression-bodied members
102-
csharp_style_expression_bodied_accessors = false:silent
119+
csharp_style_expression_bodied_accessors = true:silent
103120
csharp_style_expression_bodied_constructors = false:silent
104-
csharp_style_expression_bodied_indexers = false:silent
121+
csharp_style_expression_bodied_indexers = true:silent
105122
csharp_style_expression_bodied_lambdas = true:silent
106123
csharp_style_expression_bodied_methods = false:silent
107124
csharp_style_expression_bodied_operators = false:silent
108-
csharp_style_expression_bodied_properties = false:silent
125+
csharp_style_expression_bodied_properties = true:silent
109126

110127
# Pattern matching preferences
111128
csharp_style_prefer_pattern_matching = true:suggestion
@@ -119,9 +136,9 @@ csharp_style_conditional_delegate_call = true:suggestion
119136
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
120137

121138
# Code-block preferences
122-
csharp_prefer_braces = true:suggestion
123-
csharp_using_directive_placement = outside_namespace:warning
124-
csharp_style_namespace_declarations = file_scoped:warning
139+
csharp_prefer_braces = true:silent
140+
csharp_using_directive_placement = outside_namespace:silent
141+
csharp_style_namespace_declarations = block_scoped:silent
125142
csharp_style_unused_value_assignment_preference = discard_variable:none
126143
csharp_style_unused_value_expression_statement_preference = discard_variable:none
127144
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning
@@ -147,7 +164,7 @@ csharp_indent_block_contents = true
147164
csharp_indent_braces = false
148165
csharp_indent_case_contents = true
149166
csharp_indent_case_contents_when_block = false
150-
csharp_indent_labels = no_change
167+
csharp_indent_labels = one_less_than_current
151168
csharp_indent_switch_labels = true
152169

153170
# Space preferences
@@ -387,3 +404,10 @@ dotnet_diagnostic.SA1629.severity = none
387404
dotnet_diagnostic.SA1633.severity = none
388405
dotnet_diagnostic.SA1634.severity = none
389406
dotnet_diagnostic.SA1652.severity = none
407+
csharp_prefer_simple_using_statement = true:suggestion
408+
csharp_style_prefer_method_group_conversion = true:silent
409+
csharp_style_prefer_top_level_statements = true:silent
410+
csharp_style_prefer_primary_constructors = true:suggestion
411+
csharp_prefer_system_threading_lock = true:suggestion
412+
csharp_style_expression_bodied_local_functions = false:silent
413+
csharp_style_prefer_null_check_over_type_check = true:suggestion

.github/funding.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github: [lepoco]
1+
github: [pomianowski]

Directory.Build.props

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<Project>
2-
32
<PropertyGroup>
43
<RepositoryDirectory>$(MSBuildThisFileDirectory)</RepositoryDirectory>
54
<BuildToolsDirectory>$(RepositoryDirectory)build\</BuildToolsDirectory>
65
</PropertyGroup>
7-
86
<PropertyGroup>
97
<Version>1.0.0</Version>
10-
<PackageVersion>1.0.0-preview.3</PackageVersion>
8+
<AssemblyVersion>$(Version)</AssemblyVersion>
9+
<PackageVersion>$(Version)-preview.7</PackageVersion>
10+
<CommonTargetFramework>net9.0</CommonTargetFramework>
1111
</PropertyGroup>
12-
1312
<PropertyGroup>
1413
<Company>lepo.co</Company>
1514
<Authors>lepo.co</Authors>
@@ -23,43 +22,36 @@
2322
<PackageIcon>Icon.png</PackageIcon>
2423
<PackageIconUrl>https://github.com/lepoco/openapi.client/main/build/nuget.png</PackageIconUrl>
2524
</PropertyGroup>
26-
2725
<PropertyGroup>
2826
<NuGetAudit>true</NuGetAudit>
2927
<NuGetAuditLevel>moderate</NuGetAuditLevel>
3028
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
3129
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
3230
</PropertyGroup>
33-
3431
<PropertyGroup>
3532
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
3633
</PropertyGroup>
37-
3834
<PropertyGroup>
3935
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
40-
<LangVersion>12.0</LangVersion>
36+
<LangVersion>13.0</LangVersion>
4137
<Nullable>enable</Nullable>
42-
4338
<!--
4439
Suppress ref safety warnings in unsafe contexts (see https://github.com/dotnet/csharplang/issues/6476).
4540
This is used eg. to replace Unsafe.SizeOf<T>() calls with just sizeof(T). The warning is not necessary
4641
since in order to use these APIs the caller already has to be in an unsafe context.
4742
-->
4843
<NoWarn>$(NoWarn);CS8500</NoWarn>
4944
</PropertyGroup>
50-
5145
<PropertyGroup>
5246
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
5347
<IsCoreProject Condition="$(IsTestProject)">False</IsCoreProject>
5448
<IsCoreProject Condition="'$(IsCoreProject)' == ''">True</IsCoreProject>
5549
</PropertyGroup>
56-
5750
<PropertyGroup>
5851
<IsPackable>true</IsPackable>
5952
<IsPublishable>true</IsPublishable>
6053
<ContinuousIntegrationBuild>$(TF_BUILD)</ContinuousIntegrationBuild>
6154
</PropertyGroup>
62-
6355
<Choose>
6456
<When Condition="$(IsCoreProject)">
6557
<PropertyGroup>
@@ -75,15 +67,6 @@
7567
</PropertyGroup>
7668
</Otherwise>
7769
</Choose>
78-
79-
<!-- Include PolySharp to generate polyfills for all projects (on their .NET Standard 2.x targets) -->
80-
<ItemGroup>
81-
<PackageReference Include="PolySharp">
82-
<PrivateAssets>all</PrivateAssets>
83-
<IncludeAssets>build; analyzers</IncludeAssets>
84-
</PackageReference>
85-
</ItemGroup>
86-
8770
<Choose>
8871
<When Condition="'$(SourceLinkEnabled)' != 'false'">
8972
<PropertyGroup>
@@ -99,5 +82,4 @@
9982
</ItemGroup>
10083
</When>
10184
</Choose>
102-
10385
</Project>

Directory.Build.targets

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,41 @@
11
<Project>
2-
32
<PropertyGroup>
43
<!-- TODO: Dynamically generate Title if one wasn't set -->
54
<Title Condition="'$(Title)' == ''">$(Product) Asset</Title>
65
</PropertyGroup>
7-
86
<PropertyGroup>
97
<CommonTags Condition="$(IsCoreProject)">$(CommonTags);.NET</CommonTags>
108
<PackageTags Condition="'$(PackageTags)' != ''">$(CommonTags);$(PackageTags)</PackageTags>
119
<PackageTags Condition="'$(PackageTags)' == ''">$(CommonTags)</PackageTags>
1210
</PropertyGroup>
13-
1411
<ItemGroup Condition="$(IsPackable)">
1512
<None Include="$(BuildToolsDirectory)nuget.png" Pack="true" PackagePath="\Icon.png" Visible="False" />
1613
<None Include="$(RepositoryDirectory)ThirdPartyNotices.txt" Pack="true" PackagePath="\" Visible="False" />
1714
<None Include="$(RepositoryDirectory)LICENSE" Pack="true" PackagePath="\License.md" Visible="False" />
1815
<None Include="$(RepositoryDirectory)README.md" Pack="true" PackagePath="\README.md" Visible="False" />
1916
</ItemGroup>
20-
2117
<Target Name="AddCommitHashToAssemblyAttributes" BeforeTargets="GetAssemblyAttributes">
2218
<ItemGroup>
23-
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(SourceRevisionId)' != ''">
19+
<AssemblyAttribute
20+
Include="System.Reflection.AssemblyMetadataAttribute"
21+
Condition="'$(SourceRevisionId)' != ''"
22+
>
2423
<_Parameter1>CommitHash</_Parameter1>
2524
<_Parameter2>$(SourceRevisionId)</_Parameter2>
2625
</AssemblyAttribute>
2726
</ItemGroup>
2827
</Target>
29-
3028
<!-- Define NETSTANDARD2_1_OR_GREATER for .NET Standard 2.1 targets and above -->
3129
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0'">
3230
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
3331
</PropertyGroup>
34-
3532
<!-- Configure trimming for projects on .NET 6 and above -->
3633
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net8.0'">
3734
<IsTrimmable>true</IsTrimmable>
3835
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
3936
<EnableAotAnalyzer>true</EnableAotAnalyzer>
4037
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
4138
</PropertyGroup>
42-
4339
<!--
4440
The following target has been ported from TerraFX.Interop.Windows.
4541
See: https://github.com/terrafx/terrafx.interop.windows.
@@ -49,7 +45,9 @@
4945
performance benefits, depending on the workload.
5046
-->
5147
<PropertyGroup>
52-
<GeneratedSkipLocalsInitFile Condition="'$(GeneratedSkipLocalsInitFile)' == ''">$(IntermediateOutputPath)$(MSBuildProjectName).SkipLocalsInit.g.cs</GeneratedSkipLocalsInitFile>
48+
<GeneratedSkipLocalsInitFile Condition="'$(GeneratedSkipLocalsInitFile)' == ''"
49+
>$(IntermediateOutputPath)$(MSBuildProjectName).SkipLocalsInit.g.cs</GeneratedSkipLocalsInitFile
50+
>
5351
<GeneratedSkipLocalsInitFileLines>
5452
<![CDATA[//------------------------------------------------------------------------------
5553
// <auto-generated>
@@ -63,17 +61,21 @@
6361
[module: global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]]]>
6462
</GeneratedSkipLocalsInitFileLines>
6563
</PropertyGroup>
66-
67-
<Target Name="GenerateSkipLocalsInit"
68-
BeforeTargets="BeforeCompile;CoreCompile"
69-
DependsOnTargets="PrepareForBuild"
70-
Condition="'$(Language)' == 'C#'"
71-
Inputs="$(MSBuildAllProjects)"
72-
Outputs="$(GeneratedSkipLocalsInitFile)">
73-
64+
<Target
65+
Name="GenerateSkipLocalsInit"
66+
BeforeTargets="BeforeCompile;CoreCompile"
67+
DependsOnTargets="PrepareForBuild"
68+
Condition="'$(Language)' == 'C#'"
69+
Inputs="$(MSBuildAllProjects)"
70+
Outputs="$(GeneratedSkipLocalsInitFile)"
71+
>
7472
<!-- Write the file with the attribute -->
75-
<WriteLinesToFile Lines="$(GeneratedSkipLocalsInitFileLines)" Overwrite="true" WriteOnlyWhenDifferent="true" File="$(GeneratedSkipLocalsInitFile)" />
76-
73+
<WriteLinesToFile
74+
Lines="$(GeneratedSkipLocalsInitFileLines)"
75+
Overwrite="true"
76+
WriteOnlyWhenDifferent="true"
77+
File="$(GeneratedSkipLocalsInitFile)"
78+
/>
7779
<!-- Include the generated file in the list of files to compile -->
7880
<ItemGroup>
7981
<Compile Include="$(GeneratedSkipLocalsInitFile)" />

Directory.Packages.props

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
<Project>
22
<ItemGroup>
3-
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
4-
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
5-
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
6-
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.3.1" />
7-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
8-
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
9-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
10-
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
3+
<PackageVersion Include="AwesomeAssertions" Version="9.1.0" />
4+
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
5+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.7" />
6+
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.7" />
7+
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" />
8+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
9+
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.7" />
10+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
11+
<PackageVersion Include="Microsoft.OpenApi.YamlReader" Version="2.0.0" />
12+
<PackageVersion Include="Microsoft.OpenApi" Version="2.0.0" />
13+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
1114
<PackageVersion Include="NSubstitute" Version="5.1.0" />
12-
<PackageVersion Include="PolySharp" Version="1.13.1" />
13-
<PackageVersion Include="Spectre.Console" Version="0.49.1" />
14-
<PackageVersion Include="Spectre.Console.Analyzer" Version="0.49.1" />
15-
<PackageVersion Include="Spectre.Console.Cli" Version="0.49.1" />
16-
<PackageVersion Include="System.Buffers" Version="4.5.1" />
17-
<PackageVersion Include="System.Memory" Version="4.5.5" />
18-
<PackageVersion Include="System.Numerics.Vectors" Version="4.5.0" />
19-
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
20-
<PackageVersion Include="System.Text.Encodings.Web" Version="8.0.0" />
21-
<PackageVersion Include="System.Text.Json" Version="8.0.2" />
22-
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
23-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
24-
<PackageVersion Include="xunit" Version="2.6.2" />
15+
<PackageVersion Include="PolySharp" Version="1.15.0" />
16+
<PackageVersion Include="SharpYaml" Version="2.1.3" />
17+
<PackageVersion Include="Spectre.Console.Analyzer" Version="1.0.0" />
18+
<PackageVersion Include="Spectre.Console.Cli" Version="0.50.0" />
19+
<PackageVersion Include="Spectre.Console" Version="0.50.0" />
20+
<PackageVersion Include="System.Buffers" Version="4.6.1" />
21+
<PackageVersion Include="System.IO.Pipelines" Version="9.0.7" />
22+
<PackageVersion Include="System.Memory" Version="4.6.3" />
23+
<PackageVersion Include="System.Numerics.Vectors" Version="4.6.1" />
24+
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
25+
<PackageVersion Include="System.Text.Encodings.Web" Version="9.0.7" />
26+
<PackageVersion Include="System.Text.Json" Version="9.0.7" />
27+
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
28+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.3" />
29+
<PackageVersion Include="xunit" Version="2.9.3" />
2530
</ItemGroup>
26-
</Project>
31+
</Project>

0 commit comments

Comments
 (0)