diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8994bd6..af47ae0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -4,67 +4,66 @@
name: Build
on:
- workflow_dispatch:
+ workflow_dispatch:
push:
- branches: [ "dev"]
- paths:
+ branches: ["dev"]
+ paths:
- src/**
- test/**
pull_request:
- paths:
+ paths:
- src/**
- test/**
jobs:
build_and_test:
-
runs-on: ubuntu-latest
env:
PackageOutputDir: ".packages"
- TESTRESULTS_DIRECTORY: '.test_results'
+ TESTRESULTS_DIRECTORY: ".test_results"
steps:
- - uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Setup .NET
- uses: actions/setup-dotnet@v4
- with:
- dotnet-version: 9.0.x
-
- - name: Install GitVersion
- uses: gittools/actions/gitversion/setup@v3.0.0
- with:
- versionSpec: '6.0.5'
-
- - name: Determine Version
- run: |
- ${GITVERSION_PATH}/dotnet-gitversion /output buildserver /output json
-
- - name: Restore dependencies
- run: dotnet restore
-
- - name: Build
- run: |
- dotnet build --nologo --no-restore -p:AssemblyVersion=${GitVersion_AssemblySemVer} -p:FileVersion=${GitVersion_MajorMinorPatch} -p:Configuration=Release
-
- - name: Test
- run: |
- dotnet tool install -g dotnet-reportgenerator-globaltool --ignore-failed-sources
- dotnet test --no-restore --verbosity normal --results-directory="${TESTRESULTS_DIRECTORY}" --logger:trx --collect:"XPlat Code Coverage${CI_DOTNET_TEST_COLLECTOR_OPT}" --nologo || (true && echo "ERROR test failure" >> errors)
- reportgenerator -reports:${TESTRESULTS_DIRECTORY}/**/coverage.cobertura.xml '-reporttypes:TextSummary' -targetdir:${TESTRESULTS_DIRECTORY}/CoverageReports
- printf 'TEST_TOTAL_COVERAGE: ' && grep 'Line coverage:' ${TESTRESULTS_DIRECTORY}/CoverageReports/Summary.txt | awk -F': ' '{print $2}'
- if [ -e errors ] ; then cat errors ; exit 1 ; fi
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: 10.0.x
+
+ - name: Install GitVersion
+ uses: gittools/actions/gitversion/setup@v3.0.0
+ with:
+ versionSpec: "6.0.5"
+
+ - name: Determine Version
+ run: |
+ ${GITVERSION_PATH}/dotnet-gitversion /output buildserver /output json
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build
+ run: |
+ dotnet build --nologo --no-restore -p:AssemblyVersion=${GitVersion_AssemblySemVer} -p:FileVersion=${GitVersion_MajorMinorPatch} -p:Configuration=Release
+
+ - name: Test
+ run: |
+ dotnet tool install -g dotnet-reportgenerator-globaltool --ignore-failed-sources
+ dotnet test --no-restore --verbosity normal --results-directory="${TESTRESULTS_DIRECTORY}" --logger:trx --collect:"XPlat Code Coverage${CI_DOTNET_TEST_COLLECTOR_OPT}" --nologo || (true && echo "ERROR test failure" >> errors)
+ reportgenerator -reports:${TESTRESULTS_DIRECTORY}/**/coverage.cobertura.xml '-reporttypes:TextSummary' -targetdir:${TESTRESULTS_DIRECTORY}/CoverageReports
+ printf 'TEST_TOTAL_COVERAGE: ' && grep 'Line coverage:' ${TESTRESULTS_DIRECTORY}/CoverageReports/Summary.txt | awk -F': ' '{print $2}'
+ if [ -e errors ] ; then cat errors ; exit 1 ; fi
+
+ - name: Run codacy-coverage-reporter
+ uses: codacy/codacy-coverage-reporter-action@v1.3.0
+ with:
+ project-token: ${{ secrets.CODACY_API_KEY }}
+ coverage-reports: ${{ env.TESTRESULTS_DIRECTORY }}/**/*cobertura.xml
- - name: Run codacy-coverage-reporter
- uses: codacy/codacy-coverage-reporter-action@v1.3.0
- with:
- project-token: ${{ secrets.CODACY_API_KEY }}
- coverage-reports: ${{ env.TESTRESULTS_DIRECTORY }}/**/*cobertura.xml
-
- - name: Archive test report
- uses: actions/upload-artifact@v4
- with:
+ - name: Archive test report
+ uses: actions/upload-artifact@v4
+ with:
name: test-report
- path: ${{ env.TESTRESULTS_DIRECTORY }}/**/*.*
\ No newline at end of file
+ path: ${{ env.TESTRESULTS_DIRECTORY }}/**/*.*
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 1e708fb..a67f44c 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -35,7 +35,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
- dotnet-version: 9.0.x
+ dotnet-version: 10.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.0.0
diff --git a/ApiCodeGenerator.sln b/ApiCodeGenerator.sln
deleted file mode 100644
index bf3e60b..0000000
--- a/ApiCodeGenerator.sln
+++ /dev/null
@@ -1,90 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.0.31912.275
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{7BDF1EFD-5FD7-4E31-B3DC-A5B6CD934AC7}"
- ProjectSection(SolutionItems) = preProject
- test\Directory.Build.props = test\Directory.Build.props
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7E5C183E-07E0-4C3C-8DB0-BD7AA379053C}"
- ProjectSection(SolutionItems) = preProject
- ApiCodeGenerator.ruleset = ApiCodeGenerator.ruleset
- Directory.Build.props = Directory.Build.props
- Directory.Build.targets = Directory.Build.targets
- EndProjectSection
- ProjectSection(FolderGlobals) = preProject
- C_5_4Users_4gvpundik_4source_4Workspaces_4FORIS_3Mobile_4PRODUCTS_4Utilites_4ServiceRegistry_1NswagCodeGenerator_4test_1json__JsonSchema = nswag.jsonschema
- EndProjectSection
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCodeGenerator.MSBuild", "src\ApiCodeGenerator.MSBuild\ApiCodeGenerator.MSBuild.csproj", "{37C611D6-9875-486F-BCD5-24EC1863BA4E}"
- ProjectSection(ProjectDependencies) = postProject
- {68028B8E-B7BF-48DF-AD54-E053C8CBE562} = {68028B8E-B7BF-48DF-AD54-E053C8CBE562}
- EndProjectSection
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCodeGenerator.Core", "src\ApiCodeGenerator.Core\ApiCodeGenerator.Core.csproj", "{68028B8E-B7BF-48DF-AD54-E053C8CBE562}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCodeGenerator.Core.Tests", "test\ApiCodeGenerator.Core.Tests\ApiCodeGenerator.Core.Tests.csproj", "{03ACEDBD-691C-4A33-9D0E-BD135341246B}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCodeGenerator.AsyncApi", "src\ApiCodeGenerator.AsyncApi\ApiCodeGenerator.AsyncApi.csproj", "{BD8B40EC-BE61-46FC-9859-FE12F595C3B2}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCodeGenerator.OpenApi", "src\ApiCodeGenerator.OpenApi\ApiCodeGenerator.OpenApi.csproj", "{C0475BB3-88C0-4AF9-A1E0-813A4D90E8AC}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCodeGenerator.Abstraction", "src\ApiCodeGenerator.Abstraction\ApiCodeGenerator.Abstraction.csproj", "{4BEA0D08-9905-43B3-8D2C-41D017CE6641}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiCodeGenerator.OpenApi.Tests", "test\ApiCodeGenerator.OpenApi.Tests\ApiCodeGenerator.OpenApi.Tests.csproj", "{CA6162FC-C265-4369-88A6-2FFB07459EBA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiCodeGenerator.AsyncApi.Tests", "test\ApiCodeGenerator.AsyncApi.Tests\ApiCodeGenerator.AsyncApi.Tests.csproj", "{A375E636-A233-4CEA-9D84-C9CE2EF44D19}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {37C611D6-9875-486F-BCD5-24EC1863BA4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {37C611D6-9875-486F-BCD5-24EC1863BA4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {37C611D6-9875-486F-BCD5-24EC1863BA4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {37C611D6-9875-486F-BCD5-24EC1863BA4E}.Release|Any CPU.Build.0 = Release|Any CPU
- {68028B8E-B7BF-48DF-AD54-E053C8CBE562}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {68028B8E-B7BF-48DF-AD54-E053C8CBE562}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {68028B8E-B7BF-48DF-AD54-E053C8CBE562}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {68028B8E-B7BF-48DF-AD54-E053C8CBE562}.Release|Any CPU.Build.0 = Release|Any CPU
- {03ACEDBD-691C-4A33-9D0E-BD135341246B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {03ACEDBD-691C-4A33-9D0E-BD135341246B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {03ACEDBD-691C-4A33-9D0E-BD135341246B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {03ACEDBD-691C-4A33-9D0E-BD135341246B}.Release|Any CPU.Build.0 = Release|Any CPU
- {BD8B40EC-BE61-46FC-9859-FE12F595C3B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BD8B40EC-BE61-46FC-9859-FE12F595C3B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BD8B40EC-BE61-46FC-9859-FE12F595C3B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BD8B40EC-BE61-46FC-9859-FE12F595C3B2}.Release|Any CPU.Build.0 = Release|Any CPU
- {C0475BB3-88C0-4AF9-A1E0-813A4D90E8AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C0475BB3-88C0-4AF9-A1E0-813A4D90E8AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C0475BB3-88C0-4AF9-A1E0-813A4D90E8AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C0475BB3-88C0-4AF9-A1E0-813A4D90E8AC}.Release|Any CPU.Build.0 = Release|Any CPU
- {4BEA0D08-9905-43B3-8D2C-41D017CE6641}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4BEA0D08-9905-43B3-8D2C-41D017CE6641}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4BEA0D08-9905-43B3-8D2C-41D017CE6641}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4BEA0D08-9905-43B3-8D2C-41D017CE6641}.Release|Any CPU.Build.0 = Release|Any CPU
- {CA6162FC-C265-4369-88A6-2FFB07459EBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CA6162FC-C265-4369-88A6-2FFB07459EBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CA6162FC-C265-4369-88A6-2FFB07459EBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CA6162FC-C265-4369-88A6-2FFB07459EBA}.Release|Any CPU.Build.0 = Release|Any CPU
- {A375E636-A233-4CEA-9D84-C9CE2EF44D19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A375E636-A233-4CEA-9D84-C9CE2EF44D19}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A375E636-A233-4CEA-9D84-C9CE2EF44D19}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A375E636-A233-4CEA-9D84-C9CE2EF44D19}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {03ACEDBD-691C-4A33-9D0E-BD135341246B} = {7BDF1EFD-5FD7-4E31-B3DC-A5B6CD934AC7}
- {CA6162FC-C265-4369-88A6-2FFB07459EBA} = {7BDF1EFD-5FD7-4E31-B3DC-A5B6CD934AC7}
- {A375E636-A233-4CEA-9D84-C9CE2EF44D19} = {7BDF1EFD-5FD7-4E31-B3DC-A5B6CD934AC7}
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {B5B523BD-214D-4D5E-AE27-84B95EED0AF0}
- EndGlobalSection
-EndGlobal
diff --git a/ApiCodeGenerator.slnx b/ApiCodeGenerator.slnx
new file mode 100644
index 0000000..e45d519
--- /dev/null
+++ b/ApiCodeGenerator.slnx
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Directory.Build.props b/Directory.Build.props
index de0bdfd..07bf38e 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -8,8 +8,8 @@
12
- 14.0.2
- 11.0.2
+ 14.6.1
+ 11.5.1
diff --git a/src/ApiCodeGenerator.AsyncApi/ApiCodeGenerator.AsyncApi.csproj b/src/ApiCodeGenerator.AsyncApi/ApiCodeGenerator.AsyncApi.csproj
index eb28084..835b035 100644
--- a/src/ApiCodeGenerator.AsyncApi/ApiCodeGenerator.AsyncApi.csproj
+++ b/src/ApiCodeGenerator.AsyncApi/ApiCodeGenerator.AsyncApi.csproj
@@ -28,7 +28,7 @@
-
+
diff --git a/src/ApiCodeGenerator.MSBuild/ApiCodeGenerator.MSBuild.csproj b/src/ApiCodeGenerator.MSBuild/ApiCodeGenerator.MSBuild.csproj
index f4d0682..e4fd5bd 100644
--- a/src/ApiCodeGenerator.MSBuild/ApiCodeGenerator.MSBuild.csproj
+++ b/src/ApiCodeGenerator.MSBuild/ApiCodeGenerator.MSBuild.csproj
@@ -1,6 +1,6 @@
- net6.0;net9.0;net8.0;netstandard2.0
+ net10.0;net9.0;net8.0;netstandard2.0
true
enable
@@ -32,4 +32,4 @@
-
\ No newline at end of file
+
diff --git a/src/ApiCodeGenerator.OpenApi/ApiCodeGenerator.OpenApi.csproj b/src/ApiCodeGenerator.OpenApi/ApiCodeGenerator.OpenApi.csproj
index 50b5434..aa59268 100644
--- a/src/ApiCodeGenerator.OpenApi/ApiCodeGenerator.OpenApi.csproj
+++ b/src/ApiCodeGenerator.OpenApi/ApiCodeGenerator.OpenApi.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/test/ApiCodeGenerator.AsyncApi.Tests/ApiCodeGenerator.AsyncApi.Tests.csproj b/test/ApiCodeGenerator.AsyncApi.Tests/ApiCodeGenerator.AsyncApi.Tests.csproj
index 90fd997..31830b2 100644
--- a/test/ApiCodeGenerator.AsyncApi.Tests/ApiCodeGenerator.AsyncApi.Tests.csproj
+++ b/test/ApiCodeGenerator.AsyncApi.Tests/ApiCodeGenerator.AsyncApi.Tests.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net9.0
enable
enable
@@ -25,12 +25,12 @@
-
+
-
+
-
+
@@ -38,4 +38,7 @@
+
+
+
diff --git a/test/ApiCodeGenerator.AsyncApi.Tests/FunctionalTests.cs b/test/ApiCodeGenerator.AsyncApi.Tests/FunctionalTests.cs
index df379bd..2ce5826 100644
--- a/test/ApiCodeGenerator.AsyncApi.Tests/FunctionalTests.cs
+++ b/test/ApiCodeGenerator.AsyncApi.Tests/FunctionalTests.cs
@@ -164,7 +164,7 @@ public async Task GenerateMultipleClients()
var expIntCode1 = GetExpectedClientCode($"I{className}pub", string.Join("\n", intExpOpersCode[..1]) + "\n", typeKind: "interface");
var expIntCode2 = GetExpectedClientCode($"I{className}sub", string.Join("\n", intExpOpersCode[1..]) + "\n", typeKind: "interface");
- var expected = GetExpectedCode(string.Join("\n", [expIntCode1, expClsCode1, expIntCode2, expClsCode2]) + "\n", null);
+ var expected = GetExpectedCode(string.Join("\n", new string[] { expIntCode1, expClsCode1, expIntCode2, expClsCode2 }) + "\n", null);
Assert.AreEqual(expected, actual);
}
@@ -230,28 +230,28 @@ public async Task GenerateDiscriminator()
{{GENERATED_CODE}}
public partial class Pet
{
+
[Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)]
public string Name { get; set; }
-
}
{{GENERATED_CODE}}
public partial class Cat : Pet
{
+
[Newtonsoft.Json.JsonProperty("huntingSkill", Required = Newtonsoft.Json.Required.Always)]
public string HuntingSkill { get; set; }
-
}
{{GENERATED_CODE}}
public partial class StickInsect : Pet
{
+
[Newtonsoft.Json.JsonProperty("color", Required = Newtonsoft.Json.Required.Always)]
public string Color { get; set; }
-
}
{{JSON_INHERITANCE_CONVERTER}}
diff --git a/test/ApiCodeGenerator.AsyncApi.Tests/Infrastructure/TestHelpers.Amqp.cs b/test/ApiCodeGenerator.AsyncApi.Tests/Infrastructure/TestHelpers.Amqp.cs
index c275ac8..6a3d00b 100644
--- a/test/ApiCodeGenerator.AsyncApi.Tests/Infrastructure/TestHelpers.Amqp.cs
+++ b/test/ApiCodeGenerator.AsyncApi.Tests/Infrastructure/TestHelpers.Amqp.cs
@@ -51,7 +51,6 @@ public static string GetExpectedAmqpPublisherCode(
string name,
string payloadType,
int identCnt,
-
Exchange? exchange = null,
OperationBase? operationBinding = null)
{
diff --git a/test/ApiCodeGenerator.AsyncApi.Tests/Infrastructure/TestHelpers.cs b/test/ApiCodeGenerator.AsyncApi.Tests/Infrastructure/TestHelpers.cs
index 70f475b..2ab99a5 100644
--- a/test/ApiCodeGenerator.AsyncApi.Tests/Infrastructure/TestHelpers.cs
+++ b/test/ApiCodeGenerator.AsyncApi.Tests/Infrastructure/TestHelpers.cs
@@ -9,7 +9,7 @@ internal static partial class TestHelpers
public static readonly string VERSION = typeof(TestHelpers).Assembly.GetName().Version?.ToString() ?? string.Empty;
public static readonly string NEWTON_VERSION = "13.0.0.0";
- public static readonly string NJSON_VERSION = "11.0.2.0 (Newtonsoft.Json v" + NEWTON_VERSION + ")";
+ public static readonly string NJSON_VERSION = NswagConstants.NJSONSCHEMA_VERSION + ".0 (Newtonsoft.Json v" + NEWTON_VERSION + ")";
public static readonly string APICODEGEN_VERSION = VERSION + " (NJsonSchema v" + NJSON_VERSION + ")";
public static readonly string GENERATED_CODE = "[System.CodeDom.Compiler.GeneratedCode(\"NJsonSchema\", \"" + APICODEGEN_VERSION + "\")]";
public static readonly string GENERATED_CODE_ATTRIBUTE = "[System.CodeDom.Compiler.GeneratedCode(\"ApiCodeGenerator.AsyncApi\", \"" + APICODEGEN_VERSION + "\")]";
@@ -247,7 +247,7 @@ public static string GetExpectedDtoCode(int identCnt = 4)
var ident = new string(' ', identCnt);
return ident + GENERATED_CODE + "\n" +
ident + "public partial class LightMeasuredPayload\n" +
- ident + "{\n" +
+ ident + "{\n\n" +
ident + " /// \n" +
ident + " /// Light intensity measured in lumens.\n" +
ident + " /// \n" +
@@ -261,7 +261,7 @@ public static string GetExpectedDtoCode(int identCnt = 4)
"\n" +
ident + GENERATED_CODE + "\n" +
ident + "public partial class TurnOnOffPayload\n" +
- ident + "{\n" +
+ ident + "{\n\n" +
ident + " /// \n" +
ident + " /// Whether to turn on or off the light.\n" +
ident + " /// \n" +
@@ -276,7 +276,7 @@ public static string GetExpectedDtoCode(int identCnt = 4)
"\n" +
ident + GENERATED_CODE + "\n" +
ident + "public partial class DimLightPayload\n" +
- ident + "{\n" +
+ ident + "{\n\n" +
ident + " /// \n" +
ident + " /// Percentage to which the light should be dimmed to.\n" +
ident + " /// \n" +
@@ -374,7 +374,7 @@ public static string GetExpectedSubscriberCode(string name, string payloadType,
public static string GetAdditionalPropertiesCode(int identCnt)
{
var ident = new string(' ', identCnt);
- return "\n\n\n" +
+ return "\n" +
ident + "private System.Collections.Generic.IDictionary _additionalProperties;\n" +
"\n" +
ident + "[Newtonsoft.Json.JsonExtensionData]\n" +
diff --git a/test/ApiCodeGenerator.Core.Tests/ApiCodeGenerator.Core.Tests.csproj b/test/ApiCodeGenerator.Core.Tests/ApiCodeGenerator.Core.Tests.csproj
index 2a85632..fcb5dd1 100644
--- a/test/ApiCodeGenerator.Core.Tests/ApiCodeGenerator.Core.Tests.csproj
+++ b/test/ApiCodeGenerator.Core.Tests/ApiCodeGenerator.Core.Tests.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net9.0
@@ -9,16 +9,19 @@
-
+
-
+
-
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
-
\ No newline at end of file
+
diff --git a/test/ApiCodeGenerator.OpenApi.Tests/ApiCodeGenerator.OpenApi.Tests.csproj b/test/ApiCodeGenerator.OpenApi.Tests/ApiCodeGenerator.OpenApi.Tests.csproj
index 7a5033c..eafcfd9 100644
--- a/test/ApiCodeGenerator.OpenApi.Tests/ApiCodeGenerator.OpenApi.Tests.csproj
+++ b/test/ApiCodeGenerator.OpenApi.Tests/ApiCodeGenerator.OpenApi.Tests.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net9.0
@@ -22,12 +22,12 @@
-
+
-
+
-
+
diff --git a/test/ApiCodeGenerator.OpenApi.Tests/FunctionalTests.cs b/test/ApiCodeGenerator.OpenApi.Tests/FunctionalTests.cs
index 78058bc..294eab6 100644
--- a/test/ApiCodeGenerator.OpenApi.Tests/FunctionalTests.cs
+++ b/test/ApiCodeGenerator.OpenApi.Tests/FunctionalTests.cs
@@ -162,7 +162,7 @@ public static IEnumerable TestCaseSource()
const string expectedDtoTemplate =
" " + GENERATED_CODE + "\n" +
" public partial class TestOperResponse\n" +
- " {{\n" +
+ " {{\n\n" +
" [Newtonsoft.Json.JsonProperty(\"{1}\", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]\n" +
" public int? {0} {{ get; set; }}\n" +
"\n" +
@@ -173,7 +173,7 @@ public static IEnumerable TestCaseSource()
"\n" +
" " + GENERATED_CODE + "\n" +
" public partial class ComplexType\n" +
- " {{\n" +
+ " {{\n\n" +
" [Newtonsoft.Json.JsonProperty(\"{1}\", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]\n" +
" public int? {0} {{ get; set; }}\n" +
"\n" +
diff --git a/test/ApiCodeGenerator.OpenApi.Tests/Infrastructure/TestHelpers.cs b/test/ApiCodeGenerator.OpenApi.Tests/Infrastructure/TestHelpers.cs
index 7fbc1af..e33e353 100644
--- a/test/ApiCodeGenerator.OpenApi.Tests/Infrastructure/TestHelpers.cs
+++ b/test/ApiCodeGenerator.OpenApi.Tests/Infrastructure/TestHelpers.cs
@@ -3,15 +3,15 @@ namespace ApiCodeGenerator.OpenApi.Tests.Infrastructure
{
internal static partial class TestHelpers
{
- public const string NSWAG_VERSION = "14.0.2.0 (NJsonSchema v" + NJSON_VERSION + ")";
- public const string NJSON_VERSION = "11.0.0.0 (Newtonsoft.Json v" + NEWTON_VERSION + ")";
+ public const string NSWAG_VERSION = NswagConstants.NSWAG_VERSION + ".0 (NJsonSchema v" + NJSON_VERSION + ")";
+ public const string NJSON_VERSION = NswagConstants.NJSONSCHEMA_VERSION + ".0 (Newtonsoft.Json v" + NEWTON_VERSION + ")";
public const string NEWTON_VERSION = "13.0.0.0";
public const string GENERATED_CODE = "[System.CodeDom.Compiler.GeneratedCode(\"NJsonSchema\", \"" + NSWAG_VERSION + "\")]";
public const string GENERATED_CODE_ATTRIBUTE = "[System.CodeDom.Compiler.GeneratedCode(\"NSwag\", \"" + NSWAG_VERSION + "\")]";
public const string TestOperResponseText = " " + GENERATED_CODE + "\n" +
" public partial class TestOperResponse\n" +
- " {\n" +
+ " {\n\n" +
" [Newtonsoft.Json.JsonProperty(\"id\", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]\n" +
" public int? Id { get; set; }\n" +
"\n" +
@@ -68,13 +68,17 @@ public static string GetExpectedCode(string? expectedClientDeclartion, string te
"#pragma warning disable 114 // Disable \"CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.\"\n" +
"#pragma warning disable 472 // Disable \"CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?'\n" +
"#pragma warning disable 612 // Disable \"CS0612 '...' is obsolete\"\n" +
+ "#pragma warning disable 649 // Disable \"CS0649 Field is never assigned to, and will always have its default value null\"\n" +
"#pragma warning disable 1573 // Disable \"CS1573 Parameter '...' has no matching param tag in the XML comment for ...\n" +
"#pragma warning disable 1591 // Disable \"CS1591 Missing XML comment for publicly visible type or member ...\"\n" +
"#pragma warning disable 8073 // Disable \"CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'\"\n" +
"#pragma warning disable 3016 // Disable \"CS3016 Arrays as attribute arguments is not CLS-compliant\"\n" +
+ "#pragma warning disable 8600 // Disable \"CS8600 Converting null literal or possible null value to non-nullable type\"\n" +
+ "#pragma warning disable 8602 // Disable \"CS8602 Dereference of a possibly null reference\"\n" +
"#pragma warning disable 8603 // Disable \"CS8603 Possible null reference return\"\n" +
"#pragma warning disable 8604 // Disable \"CS8604 Possible null reference argument for parameter\"\n" +
"#pragma warning disable 8625 // Disable \"CS8625 Cannot convert null literal to non-nullable reference type\"\n" +
+ "#pragma warning disable 8765 // Disable \"CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).\"\n" +
"\n" +
$"namespace {@namespace}\n" +
"{\n" +
@@ -92,13 +96,17 @@ public static string GetExpectedCode(string? expectedClientDeclartion, string te
"#pragma warning restore 114\n" +
"#pragma warning restore 472\n" +
"#pragma warning restore 612\n" +
+ "#pragma warning restore 649\n" +
"#pragma warning restore 1573\n" +
"#pragma warning restore 1591\n" +
"#pragma warning restore 8073\n" +
"#pragma warning restore 3016\n" +
+ "#pragma warning restore 8600\n" +
+ "#pragma warning restore 8602\n" +
"#pragma warning restore 8603\n" +
"#pragma warning restore 8604\n" +
- "#pragma warning restore 8625";
+ "#pragma warning restore 8625\n" +
+ "#pragma warning restore 8765";
return expected;
}
diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets
new file mode 100644
index 0000000..d7badb5
--- /dev/null
+++ b/test/Directory.Build.targets
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+